ExpertAlmost Posted April 3, 2012 Share Posted April 3, 2012 Good morning Experts! My code creates a PNG file output 505 x 600 pixels, 24bit, 96dpi. The average file size is 130kb. No mystery there. Here is the mystery: when I open the file using ACDSee (v10) and then "save as" (even with the same filename), the file size SHRINKS to about 80kb. All the specs remain the same and I can see no difference in the image! How in the world... What could an ACDSee file-save-as be doing and how do I do it in PHP? Doing a file-save-as in Windows Paint has the same result! So I have tried to reduce the filesize in the code using compression and filters: from imagepng($Image, $ImageName) to imagepng($Image, $ImageName, 9, PNG_ALL_FILTERS). No difference. I tried running through PNGCRUSH, file size only goes to 112kb. The mystery is driving me crazy. Any ideas of what to check in my code or image? Any ideas of tricks to try in the code? A 30% filesize reduction is too great to ignore. I've attached a not-yet-shrunk file for your entertainment (It appears that the upload program wont allow my original as it is 120kb) Thank you in advance for all your ideas! Quote Link to comment https://forums.phpfreaks.com/topic/260238-mystery-shrinking-php-filesize/ Share on other sites More sharing options...
ExpertAlmost Posted April 6, 2012 Author Share Posted April 6, 2012 Just to close out the thread... My original file was interlaced! Makes for a quicker load but a larger file. I saved my base image as NOT interlaced and threw in a imageinterlace($BscImg, 0); to make sure that anything else I did was not interlaced. Reduced file size from 124KB to 79KB. No other changes in palette or sizes. Best of luck to all of you! Quote Link to comment https://forums.phpfreaks.com/topic/260238-mystery-shrinking-php-filesize/#findComment-1334867 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.