Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to create JPEG of specified size

by ikegami (Patriarch)
on Jul 25, 2007 at 15:04 UTC ( [id://628697]=note: print w/replies, xml ) Need Help??


in reply to How to create JPEG of specified size

Does the fake have to be a valid JPEG file, or just a file whose name ends with .jpg? The latter would be particularly easy to do.

If you want to produce a valid JPEG of a certain size, you play with the quality setting. It's trial an error. The amount of colours in the image will have an impact. You could also add JFIFEXIF tags to the image to increase its size.

Update: JFIF is the .jpg file format. EXIF is what the tags are called.

Replies are listed 'Best First'.
Re^2: How to create JPEG of specified size
by Limbic~Region (Chancellor) on Jul 25, 2007 at 16:39 UTC
    ikegami,
    Yes, a valid JPEG that is relatively close in filesize to the original. If you have code that exercises the trial and error or the JFIF EXIF tags I would be most appreciative.

    Cheers - L~R

      Sorry, I don't. In fact, Image::Magick would ignore the quality setting when I tried to use it in the (distant) past.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://628697]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-24 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found