How to export Preview jpeg at a specific kb size?

Remember that the JPEG format itself has no concept of DPI -- the horizontal and vertical pixel dimensions are stated for the image, but there's nothing to say how big those pixels are.

DPI is provided by the Exif metadata. That's held in the APP1 segment of the JPEG header, and the particular Exif tags concerned are "X resolution" and "Y resolution".

I don't know if sips is able to edit the Exif resolution tags without reading then writing the whole file (but I think it unlikely, that's not what it was made to do). You've more chance of doing it with a tool actually designed for editing Exif data -- we've done a bit with exiftool on the Forum, there might be more if you search, otherwise there's plenty of examples on the web.

1 Like