🛠️ToolsShed

Resmi Base64'e Dönüştür

Resimleri HTML veya CSS'e doğrudan gömmek için Base64 Data URL'ye dönüştürün.

Bir resmi buraya bırakın veya yüklemek için tıklayın

PNG, JPG, GIF, WebP, SVG desteklenir

Sıkça Sorulan Sorular

Kod Uygulaması

import base64

# Encode an image file to Base64
with open("image.png", "rb") as f:
    image_data = f.read()

encoded = base64.b64encode(image_data).decode("utf-8")
print(encoded[:40], "...")  # SGVsbG8...

# Create an HTML data URI
mime_type = "image/png"
data_uri = f"data:{mime_type};base64,{encoded}"
print(data_uri[:60])

# Decode Base64 back to file
decoded = base64.b64decode(encoded)
with open("output.png", "wb") as f:
    f.write(decoded)

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.