{"id":21634866,"url":"https://github.com/lee-seokmin/PhotoFrame","last_synced_at":"2025-10-06T11:30:17.658Z","repository":{"id":228379269,"uuid":"773731054","full_name":"seokmin12/PhotoFrame","owner":"seokmin12","description":"📸 A website that frames the metadata of a photo.","archived":false,"fork":false,"pushed_at":"2024-12-20T00:06:27.000Z","size":254,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-12-20T01:18:46.469Z","etag":null,"topics":["fastapi","nextjs","photography","photoshop-crack","python","react"],"latest_commit_sha":null,"homepage":"https://photoframe.kro.kr","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seokmin12.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-18T09:49:39.000Z","updated_at":"2024-12-20T00:06:31.000Z","dependencies_parsed_at":"2024-04-16T09:27:22.456Z","dependency_job_id":"9a564b8d-c3f4-4ff7-b222-6f19dab9af4d","html_url":"https://github.com/seokmin12/PhotoFrame","commit_stats":null,"previous_names":["seokmin12/photoframe"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seokmin12%2FPhotoFrame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seokmin12%2FPhotoFrame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seokmin12%2FPhotoFrame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seokmin12%2FPhotoFrame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seokmin12","download_url":"https://codeload.github.com/seokmin12/PhotoFrame/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235520641,"owners_count":19003328,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","nextjs","photography","photoshop-crack","python","react"],"created_at":"2024-11-25T03:18:28.131Z","updated_at":"2025-10-06T11:30:17.643Z","avatar_url":"https://github.com/seokmin12.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"이 웹사이트는 [Next.js](https://nextjs.org/)를 사용해 만들어졌습니다.\n\n\u003cbr\u003e\n\n[![Netlify Status](https://api.netlify.com/api/v1/badges/7913246e-2b44-4772-9f57-2f4119fa43a4/deploy-status)](https://app.netlify.com/sites/photoframeo/deploys)\n\n## 이 사이트를 만든 목적\n\n인스타그램에 자신이 찍은 사진을 올릴 때, 원본 그대로 올리는 것 보다 그 사진의 [EXIF](https://namu.wiki/w/EXIF)(셔터 스피드, 조리개 값, ISO등)를 입력해 놓음으로써 사람들이 정보를 알 수 있게 되는 프레임을 만드는 것이 유행이다.  \n그러나, 이 작업은 포토샵으로 일일이 입력해야 하다는 것이 단점이었다. 그래서 이 작업을 Python 코드로 자동화하여 사용자에게 제공하면 더욱 편리하겠다는 생각을 하여 만들었다.\n\n\n## Getting Started\n\n먼저, 로컬 서버에서 다음의 커맨드를 실행한다:\n\n```bash\nnpm run dev\n# or\nyarn dev\n# or\npnpm dev\n# or\nbun dev\n```\n\n로컬 주소 [http://localhost:3000](http://localhost:3000)에 접속하여 결과물을 확인한다.\n\n## 주요 코드\n\n```typescript\nfunction setupCanvas(imgWidth: number, imgHeight: number, padding: number, metadataHeight: number): {\n  canvas: HTMLCanvasElement;\n  ctx: CanvasRenderingContext2D;\n  canvasWidth: number;\n  canvasHeight: number;\n  scaledImgWidth: number;\n  scaledImgHeight: number;\n  imgX: number;\n  imgY: number;\n} {\n  // 고정 캔버스 크기\n  const canvasWidth = 1080 * 2;\n  const canvasHeight = 1350 * 2;\n  \n  const canvas = document.createElement('canvas');\n  canvas.width = canvasWidth;\n  canvas.height = canvasHeight;\n  \n  const ctx = canvas.getContext('2d');\n  if (!ctx) throw new Error('Could not get canvas context');\n  \n  // 배경 설정\n  ctx.fillStyle = 'white';\n  ctx.fillRect(0, 0, canvasWidth, canvasHeight);\n  \n  // 이미지 크기 계산 (캔버스에 맞게 스케일링)\n  const imageArea = canvasHeight - (padding * 5) - metadataHeight;\n  const scale = Math.min(\n    (canvasWidth - padding * 2) / imgWidth,\n    imageArea / imgHeight\n  );\n  \n  const scaledImgWidth = imgWidth * scale;\n  const scaledImgHeight = imgHeight * scale;\n  \n  // 이미지 위치 계산 (가로 및 세로 중앙 정렬)\n  const imgX = (canvasWidth - scaledImgWidth) / 2;\n  \n  // 가로 이미지(landscape)인 경우 수직 중앙 정렬\n  let imgY = padding * 2;\n  if (imgWidth \u003e imgHeight) {\n    // 가로 이미지면 수직으로도 중앙에 배치\n    imgY = (canvasHeight - metadataHeight - scaledImgHeight) / 2;\n  }\n  \n  return {\n    canvas,\n    ctx,\n    canvasWidth,\n    canvasHeight,\n    scaledImgWidth,\n    scaledImgHeight,\n    imgX,\n    imgY\n  };\n}\n```\n\n## 로직\n\n```mermaid\nflowchart LR\n    A(프론트엔드)\n    B[사진의 메타 데이터 가져오기]\n    C[canvas를 이용하여\n    흰 배경 만들기]\n    D[원본 사진을 일정한 \n    비율에 맞춰 resize하기]\n    E[흰 배경에 resize된 사진과\n    메타 데이터 입력하기]\n\n    A ---\u003e |사진 전송| B\n    subgraph 백엔드\n    B --- C --- D --- E\n    end\n    E ---\u003e |생성된 이미지를 base64로 \n    인코딩하여 return하기| A\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flee-seokmin%2FPhotoFrame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flee-seokmin%2FPhotoFrame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flee-seokmin%2FPhotoFrame/lists"}