시작하기
img2htm API는 이미지 파일 또는 URL을 받아 HTML, CSS, 분리 이미지, 구조화 JSON, 품질 리포트를 반환합니다. 매월 첫 50회 미리보기 호출은 무료입니다.
- 계정 만들기 → 대시보드에서 키 발급
POST https://img2htm.com/api/v1/reconstructwithimage_file,image_urlorimage_file_b64.- Receive HTML, CSS, separated assets, structured JSON and a quality report in one response.
쉬운 통합
cURL, Node.js, Python, PHP, Ruby, Java, .NET, Swift 예제를 제공합니다.
HTML + CSS + JSON
한 번의 API 호출로 HTML·CSS·분리 이미지·구조화 JSON·품질 리포트를 받으세요.
크레딧이란?
1 크레딧으로 세로 15,000 px까지의 이미지 1장을 전체 변환할 수 있습니다. 더 긴 이미지는 자동으로 여러 크레딧이 계산됩니다. 미리보기는 무료입니다.
인증
API 키는 Authorization: Bearer 헤더 또는 X-Api-Key 헤더로 전달합니다.
Authorization: Bearer i2h_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# or
X-Api-Key: i2h_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
샘플 코드
curl -X POST https://img2htm.com/api/v1/reconstruct \ -H "Authorization: Bearer i2h_your_api_key" \ -F "image_file=@product-page.jpg" \ -F "mode=full" \ -F "format=json"
import fs from 'node:fs';
const form = new FormData();
form.append('image_file', new Blob([fs.readFileSync('product-page.jpg')]), 'product-page.jpg');
form.append('mode', 'full');
const res = await fetch('https://img2htm.com/api/v1/reconstruct', {
method: 'POST',
headers: { Authorization: 'Bearer i2h_your_api_key' },
body: form,
});
const job = await res.json();
console.log(job.status, job.urls.html);import requests
with open('product-page.jpg', 'rb') as f:
r = requests.post(
'https://img2htm.com/api/v1/reconstruct',
headers={'Authorization': 'Bearer i2h_your_api_key'},
files={'image_file': f},
data={'mode': 'full', 'format': 'json'},
timeout=600,
)
job = r.json()
print(job['status'], job['sections'], job['urls']['zip'])<?php
$ch = curl_init('https://img2htm.com/api/v1/reconstruct');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer i2h_your_api_key'],
CURLOPT_POSTFIELDS => [
'image_file' => new CURLFile('product-page.jpg'),
'mode' => 'full',
],
]);
$job = json_decode(curl_exec($ch), true);
file_put_contents('index.html', $job['html']);require 'net/http'
require 'json'
uri = URI('https://img2htm.com/api/v1/reconstruct')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer i2h_your_api_key'
req.set_form([['image_file', File.open('product-page.jpg')], ['mode', 'full']], 'multipart/form-data')
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
job = JSON.parse(res.body)
puts job['status']HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://img2htm.com/api/v1/reconstruct"))
.header("Authorization", "Bearer i2h_your_api_key")
.header("Content-Type", "application/x-www-form-urlencoded")
.POST(HttpRequest.BodyPublishers.ofString(
"image_url=https://example.com/page.jpg&mode=full"))
.build();
HttpResponse<String> res = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new("Bearer", "i2h_your_api_key");
using var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("product-page.jpg")), "image_file", "product-page.jpg");
form.Add(new StringContent("full"), "mode");
var res = await http.PostAsync("https://img2htm.com/api/v1/reconstruct", form);
Console.WriteLine(await res.Content.ReadAsStringAsync());var request = URLRequest(url: URL(string: "https://img2htm.com/api/v1/reconstruct")!)
request.httpMethod = "POST"
request.setValue("Bearer i2h_your_api_key", forHTTPHeaderField: "Authorization")
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.httpBody = "image_url=https://example.com/page.jpg&mode=full".data(using: .utf8)
let (data, _) = try await URLSession.shared.data(for: request)
print(String(data: data, encoding: .utf8)!) 출력 형식
format | 설명 |
|---|---|
json | Default. JSON object with html, css, content (structured sections + texts), assets (separated image URLs), quality and urls. |
html | Returns the reconstructed index.html document directly (text/html). |
zip | Streams a ZIP with index.html, styles.css, content.json, quality.json, sections/ and assets/. |
응답
{
"id": "3f9a1c2b7d4e6f80a1b2",
"status": "done",
"mode": "full",
"credits_used": 2,
"width": 860,
"height": 24000,
"sections": 16,
"quality": {
"text_accuracy": 97.4,
"visual_fidelity": 94.1,
"structure": 95.2,
"sections": 16,
"seconds": 41.8,
"provider": "anthropic:claude-sonnet-5",
"review": [],
"auto_pass": true
},
"urls": {
"html": "https://img2htm.com/api/v1/jobs/3f9a1c2b7d4e6f80a1b2/html",
"zip": "https://img2htm.com/en/convert/3f9a1c2b7d4e6f80a1b2/download",
"preview": "https://img2htm.com/en/convert/3f9a1c2b7d4e6f80a1b2/preview"
},
"assets": ["https://img2htm.com/files/results/3f9a1c2b7d4e6f80a1b2/assets/s01-a01.png"],
"html": "<!DOCTYPE html> ...",
"css": "/* img2htm base styles */ ...",
"content": { "sections": [ ... ], "texts": [ ... ] }
}
API 레퍼런스
Reconstruct an image
| 파라미터 | 타입 | 설명 |
|---|---|---|
image_file 필수* | file | Multipart upload. JPG, PNG or WebP, up to 25 MB. *One of image_file, image_url, image_file_b64 is required. |
image_url | string | Public HTTP(S) URL of the image. |
image_file_b64 | string | Base64-encoded image data. |
mode 선택 | full | preview | full (default) converts the whole image and charges 1 credit per 15,000 vertical px. preview converts only the top 3,000 px for free. |
lang 선택 | string | Output document language tag: ko, en, cn, tw, ja, mn, ru, th, id, vi, ar. Text is kept in its source language; this sets <html lang>/dir. |
format 선택 | json | html | zip | Response format (see above). |
async 선택 | 1 | Return 202 Accepted immediately; poll GET /api/v1/jobs/{id} for the result. |
Get a job
Returns the job object. Add ?include_html=1 to embed html, css and content.
Get the HTML document
Returns index.html as text/html.
Account
{ "email": "you@example.com", "credits": 38, "pixels_per_credit": 15000, "key": "i2h_ab12cd34…", "calls": 1207 }
요청 한도
분당 60 이미지 per API key. When exceeded the API responds 429 Too Many Requests with a Retry-After: 60 header. Enterprise plans can raise this limit.
지수 백오프
On 429 or 5xx, retry with exponential backoff: wait 1s, 2s, 4s, 8s … up to 5 attempts, adding random jitter. Never retry 4xx errors other than 429.
delay = min(60, (2 ** attempt) + random(0, 1))
오류 코드
| HTTP | 설명 |
|---|---|
400 | Missing image or unreadable URL. |
401 | Missing, invalid or revoked API key. |
402 | Insufficient credits. Response includes credits_needed and credits_available. |
413 | File exceeds the upload limit. |
415 | Unsupported image type. |
429 | Rate limit exceeded. |
500 | Conversion failed. Credits charged for the job are refunded automatically; error contains the reason. |
라이브러리와 도구
통합/도구/앱
Zapier 또는 Make를 사용하면 img2htm을 2,000개 이상의 앱과 연결할 수 있습니다.
Chrome 확장 프로그램
어떤 웹페이지에서든 통이미지를 우클릭 한 번으로 HTML로 변환하세요.
윈도우/맥/리눅스
폴더 단위 대량 변환, 드래그 앤 드롭, 오프라인 큐. 크레딧은 웹과 동일하게 사용됩니다.