• Resolved Davide Roccato

    (@davidroccato)


    Hi,

    I just want to mention that with a lot of PNG files I had to re-optimize the process to make them convert to JPG. The first step used to reduce a bit the size, the second step used to reduce them further and finally convert them to JPG.

    I think it did like this with most of PNG images, and lots of screenshots, not only logos.

    Some PNG still keeps being not converted even if I try multiple times, and it’s a screenshot. But the most of them now are fine.

    In any case, I’ve optimized 5000 images, but in groups of 400 each to avoid too much stress.

    https://wordpress.org/plugins/ewww-image-optimizer/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author nosilver4u

    (@nosilver4u)

    That should not be happening. Do you still have any images not converted that I can do some testing with?

    Hey there,

    I am having the same problem with PNG to JPG conversion. It WAS working in the past and I used it quite frequently.

    Looking over the server error logs and the TOP command I can confirm that optipng is running and pngout is running without error.

    The converted files are output to the media folders in the wordpress instance (with a -1 or -2 etc.).

    However, it seems the database is not being updated to reflect the change and so it continues to use the old image and shows that in the media section of the admin panel.

    I hope this is useful to you in troubleshooting the error.

    Also I am running the latest wordpress instance 3.8.1

    Best Regards,
    SciFighting

    Plugin Author nosilver4u

    (@nosilver4u)

    Can either of you turn on debugging, and then paste the attachment metadata shown in yellow for one of these images in the Media Library?

    Thread Starter Davide Roccato

    (@davidroccato)

    sure, this is one. I’m noticing there are still info on smush.it I had before and that I have deactivated.

    Array
    (
        [width] => 300
        [height] => 513
        [file] => 2012/03/happyshutter2.png
        [sizes] => Array
            (
                [thumbnail] => Array
                    (
                        [file] => happyshutter2-87x150.png
                        [width] => 87
                        [height] => 150
                        [mime-type] => image/png
                        [wp_smushit] => Reduced by 2.6% (391 B)
                        [ewww_image_optimizer] => No savings
                    )
                [medium] => Array
                    (
                        [file] => happyshutter2-175x300.png
                        [width] => 175
                        [height] => 300
                        [mime-type] => image/png
                        [wp_smushit] => Reduced by 1.6% (797 B)
                        [ewww_image_optimizer] => No savings
                    )
            )
        [image_meta] => Array
            (
                [aperture] => 0
                [credit] =>
                [camera] =>
                [caption] =>
                [created_timestamp] => 0
                [copyright] =>
                [focal_length] => 0
                [iso] => 0
                [shutter_speed] => 0
                [title] =>
            )
        [wp_smushit] => Reduced by 1.9% (2.7 KB)
        [ewww_image_optimizer] => No savings
    )
    Plugin Author nosilver4u

    (@nosilver4u)

    Can you provide a link to that file, so I can test it on my dev site?

    Thread Starter Davide Roccato

    (@davidroccato)

    Sure, link

    It’s been optimised twice. I didn’t try a third time

    Plugin Author nosilver4u

    (@nosilver4u)

    Images with transparency can only be converted if you set a background color. The background setting is empty by default because many people don’t want PNGs with transparency converted (because JPGs can’t do transparency).

    Thread Starter Davide Roccato

    (@davidroccato)

    Well, this happened to other hundreds of images where the first time weren’t converted and the second time yes. I don’t think all of them had transparency because the most of them were screenshots taken with my Mac, or directly from iPhone or iPad.

    Maybe the ones left now have transparency but it’s not easy going through 5000 images to find the right ones. You might want to try with these:

    Array
    (
        [width] => 525
        [height] => 248
        [file] => 2012/03/inkapp.png
        [sizes] => Array
            (
                [thumbnail] => Array
                    (
                        [file] => inkapp-150x70-1.jpg
                        [width] => 150
                        [height] => 70
                        [mime-type] => image/png
                        [wp_smushit] => Reduced by 11.1% (402 B)
                        [ewww_image_optimizer] => Reduced by 10.6% (303.0 B)
                        [converted] => 1
                        [orig_file] => inkapp-150x70.png
                    )
                [medium] => Array
                    (
                        [file] => inkapp-300x141-1.jpg
                        [width] => 300
                        [height] => 141
                        [mime-type] => image/png
                        [wp_smushit] => Reduced by 10.3% (1.1 KB)
                        [ewww_image_optimizer] => Reduced by 12.6% (1.0 kB)
                        [converted] => 1
                        [orig_file] => inkapp-300x141.png
                    )
            )
        [image_meta] => Array
            (
                [aperture] => 0
                [credit] =>
                [camera] =>
                [caption] =>
                [created_timestamp] => 0
                [copyright] =>
                [focal_length] => 0
                [iso] => 0
                [shutter_speed] => 0
                [title] =>
            )
        [wp_smushit] => Reduced by 47.6% (9.8 KB)
        [ewww_image_optimizer] => No savings
    )

    The above is for this first link

    Array
    (
        [width] => 612
        [height] => 300
        [file] => 2012/02/terraorba1.png
        [sizes] => Array
            (
                [thumbnail] => Array
                    (
                        [file] => terraorba1-150x73.png
                        [width] => 150
                        [height] => 73
                        [mime-type] => image/png
                        [wp_smushit] => Reduced by 0.9% (134 B)
                        [ewww_image_optimizer] => Reduced by 12.4% (1.7 kB)
                    )
                [medium] => Array
                    (
                        [file] => terraorba1-300x147.png
                        [width] => 300
                        [height] => 147
                        [mime-type] => image/png
                        [wp_smushit] => Reduced by 1.2% (636 B)
                        [ewww_image_optimizer] => Reduced by 12.4% (6.1 kB)
                    )
            )
        [image_meta] => Array
            (
                [aperture] => 0
                [credit] =>
                [camera] =>
                [caption] =>
                [created_timestamp] => 0
                [copyright] =>
                [focal_length] => 0
                [iso] => 0
                [shutter_speed] => 0
                [title] =>
            )
        [wp_smushit] => Reduced by 4.2% (7.8 KB)
        [ewww_image_optimizer] => Reduced by 12.3% (22.1 kB)
    )

    Second link

    Array
    (
        [width] => 480
        [height] => 514
        [file] => 2012/02/juxgrid.png
        [sizes] => Array
            (
                [thumbnail] => Array
                    (
                        [file] => juxgrid-140x150.png
                        [width] => 140
                        [height] => 150
                        [mime-type] => image/png
                        [wp_smushit] => Reduced by 1.9% (402 B)
                        [ewww_image_optimizer] => No savings
                    )
                [medium] => Array
                    (
                        [file] => juxgrid-280x300.png
                        [width] => 280
                        [height] => 300
                        [mime-type] => image/png
                        [wp_smushit] => Reduced by 3.0% (2.1 KB)
                        [ewww_image_optimizer] => No savings
                    )
            )
        [image_meta] => Array
            (
                [aperture] => 0
                [credit] =>
                [camera] =>
                [caption] =>
                [created_timestamp] => 0
                [copyright] =>
                [focal_length] => 0
                [iso] => 0
                [shutter_speed] => 0
                [title] =>
            )
        [wp_smushit] => No savings
        [ewww_image_optimizer] => No savings
    )

    Third link

    I hope these are better examples.

    Plugin Author nosilver4u

    (@nosilver4u)

    1. inkapp.png is still smaller as a png, so it can’t be converted (well, it could, but the plugin checks for filesize and skips conversion if the new images is larger than the original).

    2. terraorba1.png was better as a jpg, but I had no trouble converting it on my dev site, naturally. Replicating these types of things is very tricky. I really don’t doubt that there could be a bug, as there’s a lot of code involved, and I’m only human, so I don’t expect perfection…

    3. juxgrid.png was another one that had transparency, there was just a small transparent border around the edge, so the plugin would skip this one as well unless there was a background fill color entered in the settings.

    So, here’s what I’m wondering, can you try this (which should replicate what you did originally, if I’m understanding correctly):

    1. Disable the optimizer plugin.

    2. Upload 10-15 screenshots that you have original pngs for. Alternatively, if you left the originals in place on the server, you could download those to your computer to use for this test.

    3. Enable the plugin.

    4. Make sure PNG to JPG conversion is turned on, as well as debugging, and then run the bulk optimize for just the new ones you uploaded (you can use the Bulk Optimize from the actions menu on the Media Library if you hadn’t discovered that yet).

    There will be debugging info output for every image run through the bulk optimizer. So, if they don’t convert properly, copy the debugging info for one or two of them (might want to use pastebin.com for this), and we’ll see if we can spot anything amiss.

    Plugin Author nosilver4u

    (@nosilver4u)

    @scifighting – not sure if I found the bug you were talking about, but there was an issue where resizes inserted into posts weren’t being updated that I just fixed in ‘dev’. As far as the actual media library, it didn’t seem to affect anything there (which is why it went undetected for so long).

    Plugin Author nosilver4u

    (@nosilver4u)

    I think I just found the problem, but I’m not sure how to fix it. I was doing some testing, and stumbled across an image that was giving me issues.

    So, I tested this, that, the other thing, and it still wouldn’t convert on initial upload, only when I retried the conversion. I added some debugging to my alpha-channel function (aka transparency), and discovered it had an alpha channel.

    What is happening is this:
    On the first pass, it tries to convert the image, but the plugin says “no thanks, there’s transparency in that image.” THEN it optimizes the image with optipng (and pngout if you have it). Both tools detect the alpha channel and the fact that there is nothing in it, so the alpha channel is removed. Result of first pass, and optimized, but unconverted PNG.
    On the second pass, it tries to convert the image, the alpha channel has been removed, and the plugin says, “here you go, a lovely JPG.” If the JPG is smaller than the optimized PNG, then the conversion is successful.

    From what I can tell, the only way to rectify this behavior is to have the image optimized BEFORE attempting conversion, which is going to be a significant amount of work. I think it’s worth doing, but it might have to wait until after I get 1.8.0 released.

    Thread Starter Davide Roccato

    (@davidroccato)

    Yes, I think this is exactly what happened. It’s not a problem for blogs with few images, or few PNGs, but it could be a problem for blogs with thousands of images and hundreds of PNGs. It’s great you were able to find what it is in any case.

    1) One faster temporary solution could be at least to have the possibility to organise the images for type. So that, if people could choose to display only the PNGs left, it would be easier to re-optimise them a second time instead of looking for them in the middle of all of others. This could be a nice feature in any case.

    2) Another couple of features, that I don’t know if I can write here, could be to have the possibility to choose to display only the pictures above some size. Let’s say, all the pictures above 300kb, or 400kb. That would speed up the process to manually optimise the library, chasing all the pictures above a particular size, and change them manually.

    3) And lastly, and I don’t know if it’s possible, it would be nice to understand if there are images not used anymore in any file. The attach/unattach doesn’t work, because even images unattached can be used in some post. If this feature is possibile, it could be useful to do some clean up.

    thanks anyway for this awesome plugin.

    Plugin Author nosilver4u

    (@nosilver4u)

    Issue fixed in latest release, 1.8.0.
    As for the other requests:

    #2: I’ve had similar requests, see this post, and add your +1: http://wordpress.org/support/topic/feature-request-convert-only-largest-files?replies=1

    #3: There are a couple plugins that do this already, most notably: http://wordpress.org/plugins/cleanup-images/
    However, cleaning up images is tricky business, as evidenced by the reviews of that plugin. Determining if another plugin uses an image is next to impossible and given the myriad of image-related plugins, trying to accomodate for all of them would be a daunting task at best.

    Thread Starter Davide Roccato

    (@davidroccato)

    Thank you very much, you’re really great.

    I’ve added a +1 to that feature and I’ll check the plugin you suggested probably the next week. I suppose it’s a very difficult task anyway. Thanks.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘PNG needs 2 steps to be converted.’ is closed to new replies.