Get resized image file size before MagickWriteImage() ?

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Generally you can only know the image file size by writing it to memory or disk first. Some formats are predicatable in size based on the image width and height but generally this is not reliable for most image formats.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

You want to write to a blob to measure the image size in memory. MagickWand has a MagickWriteImageBlob() method. There may be a similar method in MagickWand for PHP.
Post Reply