+ Reply to Thread
Results 1 to 6 of 6

Thread: too large png images

  1. #1
    Senior Member
    Join Date
    Dec 2023
    Posts
    161

    too large png images

    The image upload routine works great and efficiently for jpg images.

    Good test - jpg works great, as expected with jpg quality set default 70.
    If a user upload a large jpg file, the system saves the thumbnail and large sizes, and resizes the original to 2x large and saves as a jpg.
    JPG Test: upload jpg of 6000x4000 pixels 7.5 MB. System saves
    .jpg thumbnail 200 pixels 5 KB
    _x2.jpg 400 pixels 20 KB
    _large.jpg 1200 pixels 133 KB
    _orig.jpg 2400 pixels wide. 696 KB
    OK.


    Bad test - pngs sometimes are very unoptimized:
    If a user uploads a large png file, the system saves an _orig.png that is also extremely large, and sometimes doesn't seem to resize it.
    RGB PNG Test1: upload png rgb 6000x4000 pixels 17.1 MB. System saves _orig.png which is 17.1 MB and not resized.
    .jpg thumbnail 200 pixels 51KB
    _x2.jpg 400 pixels 232 KB
    _large.jpg 1200 pixels 1.5 MB
    _orig.jpg 6000 pixels 17.1 MB
    Problem: _orig.png not optimized at all, and both jpg thumbnail and large image excessively large (10x file size compared to jpg input original) slowing down page.



    RGB PNG Test2: upload png rgb 3500x2332 pixels 7.6 MB. System saves _orig png which is 5.2 MB resized to 2400 pixels wide. Also very unoptimized.
    .jpg thumbnail 200 pixels 55KB
    _x2.jpg 400 pixels 224KB
    _large.jpg 1200 pixels 1.5 MB
    _orig.jpg 2400 pixels 5.2MB
    Problem: _orig.png not optimized well, and both jpg thumbnail and large image excessively large slowing down page.
    Last edited by Horizon; January 17, 2024 at 09:29 AM.

  2. #2
    Try to use .webp format
    Viktor,
    Flynax technical department,
    Best wishes.

  3. #3
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    Will try changing setting from output format jpg to output format webp under admin, basic settings, pictures and test again.

  4. #4
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    Tests repeated with same input images, now with output format set to webp:

    User upload of large jpg file:
    JPG Test4: upload jpg of 6000x4000 pixels 7.5 MB.
    .webp thumbnail 200 pixels 5 KB --5,387 KB
    _x2.webp 400 pixels 20 KB --20,028 KB
    _large.webp 1200 pixels 133 KB --133,252 KB
    _orig.jpg 2400 pixels wide. 696 KB --696,311 KB
    No problem with this, as before, input jpg -> output webp and input jpg -> output.jpg are both ok. I'm actually not seeing any noticeable difference in size, just extension change on the output files...


    Now repeating png input test, webp output still bad when uploading the super-large png file as user...
    If a user uploads a large png file, the system saves an _orig.png that is also extremely large, and sometimes doesn't seem to resize it.
    RGB PNG Test5: upload png rgb 6000x4000 pixels 17.1 MB.
    .webp thumbnail 200 pixels 52 KB --51,764 KB
    _x2.webp 400 pixels 232 KB --232,285 KB
    _large.webp 1200 pixels 1.5 MB --1,547,756 KB
    _orig.png 6000 pixels 17.1 MB
    Problem didn't change here - extension changed, but file sizes are still the same basically.



    RGB PNG Test6: upload png rgb 3500x2332 pixels 7.6 MB.
    .webp thumbnail 200 pixels 55KB
    _x2.webp 400 pixels 224KB
    _large.webp 1200 pixels 1.5 MB
    _orig.png 2400 pixels 5.2MB
    As above, not seeing a major improvement. Numbers didn't really change except I can see the file extension changed.

    If the user uploads a big input photo as jpg, the thumbnail is 5 KB. If they upload a same-resolution big png, the thumbnail is 55 KB!

    10x as large.

    _large image if they upload jpg ends up being 133 KB. If they upload PNG the large.webp or large.jpg ends up being huge at 1.5 MB.
    Last edited by Horizon; January 17, 2024 at 04:00 PM.

  5. #5
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    OK, I figured out that:
    1.) with autocropping=enabled for large pictures, png files correctly compress to jpg output files (much better compression than png for things like screenshots that users may upload); however
    2.) with autocropping=disabled for large pictures, if a user uploads a png file, it gets renamed to jpg file extension, but is not actually compressed as a jpg file but seems to still be png format (???*) and very large file size compared to jpg.

    (* if I upload abc.png with autocropping=disabled, and then download the resulting abc_large.jpg file, opening it in a text editor the top line is ‰PNG.
    Trying to open the abc_large.jpg as a jpeg file with a local image editor produces an "invalid header" message. So somehow it is not actually being optimized to a jpg file if autocropping=disabled.)
    Last edited by Horizon; February 6, 2024 at 02:38 AM.

  6. #6
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    I opened a ticket on this since I seemed to be the only one seeing this and flynax provided the fix:

    The issue was that the PHP fileinfo library was not enabled on the server; enabling the fileinfo module, and flynax produces the correct jpg or webp output files now when users upload png input files.

    Thanks!
    Last edited by Horizon; February 12, 2024 at 09:16 AM.

+ Reply to Thread