+
+
+
Upload
+
Drag & drop or pick a file
+
+ {image && (
+
+ {image.width}×{image.height}px
+
+ )}
+
+
+
{
+ e.preventDefault();
+ setIsDragging(true);
+ }}
+ onDragEnter={() => setIsDragging(true)}
+ onDragLeave={() => setIsDragging(false)}
+ onDrop={(e) => {
+ e.preventDefault();
+ setIsDragging(false);
+ onFile(e.dataTransfer.files?.[0]);
+ }}
+ className={`rounded-xl border border-dashed ${isDragging ? "border-primary bg-black/60" : "border-[#222222] bg-black/40"
+ } p-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 transition-colors`}
+ >
+
+
+ {fileName || "Drop an image here…"}
+
+
We never upload your file.
+
+
+ {src && (
+
+ )}
+
+
+
+
+
+
Resize
+
Set output dimensions in pixels
+
+
+
+
+
+
+
+
Locks width/height together.
+
+
setKeepAspectRatio(e.target.checked)}
+ disabled={!image}
+ />
+
+
+
+
Export
+
Choose format and compression
+
+
+
+
+
+
+
+
+ {format !== "png" && (
+
+
+ Quality
+ {quality}
+
+
setQuality(Number(e.target.value))}
+ style={{ accentColor: "#00DA92" }}
+ className="w-full mt-2"
+ />
+
+ )}
+
+
+
+
+
Target file size
+
+ Works for JPG/WebP (PNG is lossless).
+
+
+
+
+ setTargetSize(Number(e.target.value))}
+ className="col-span-2 w-full bg-black border border-[#222222] rounded-lg px-3 py-2 text-white focus:outline-none focus:border-primary"
+ disabled={!image || format === "png"}
+ />
+
+
+
+
+
+ {format === "jpg" && (
+
+
+
+
Background
+
JPG has no transparency.
+
+
+ setTransparent(!e.target.checked)}
+ />
+
+
+
+
+
+
setBg(e.target.value)}
+ className="w-9 h-9 rounded-md border border-[#222222]"
+ disabled={transparent}
+ />
+
+ {["#ffffff", "#000000", "#f43f5e", "#f59e0b", "#10b981", "#3b82f6"].map((c) => (
+
+
+
+ )}
+
+
+
+
+
+