I'm a new user of this module for D8 and I've set up a few image styles to use a resmush.it pipeline with the 2016-Oct-05 dev version, which seem to work, although I'm not seeing a huge difference in resulting filesizes between resmush.it and the imagick library I was using.
I was primarily interested in optimizing the filesize of the "original" image upon uploading (this is typically where we can save most space), but I do not see any significant optimization happening there and I can't find a way to set a pipeline for this image size, since there is no original style... I was expecting to find something on /admin/config/media/image-toolkit or on the admin content-type field form where a max resolution can be set, but I haven't found it. Did I miss anything?
Comments
Comment #2
jcisio CreditAttribution: jcisio at Axess Open Web Services for ARTE G.E.I.E. commentedThere is no such option now, but I can see it is a useful feature to add.
Comment #3
juliencarnot CreditAttribution: juliencarnot commentedThanks for your quick answer! In my view, it could be nice to have the option to optimize even if no resize is carried out, would that be possible too?
Comment #4
jcisio CreditAttribution: jcisio at Axess Open Web Services for ARTE G.E.I.E. commentedI haven't evaluated the feasibility of either options, in either D7 or D8. This is just an open request request.
Comment #5
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedDrupal tends to have a policy of not changing files as they are uploaded, but rather doing the processing when someone requests the file.
That way, the original is preserved in case you need it for any reason.
If you just want the original image, but optimized, then you just need to use an image style that doesn't have any actions, but then select and image optimize pipeline on it. It'll go through image styles in the usual way, remain the same pixel size, but then go through and be optimized.
As for the optimization levels of reSmush.it, yeah, they aren't great. There are alternatives like Kraken and Tiny PNG that tend to do a better job, the former has integration with the D8 version of this module.
Comment #6
juliencarnot CreditAttribution: juliencarnot commentedThanks for your feedback Steven!
I perfectly understand the idea behind keeping the original file in its original state, but for a user contributed website, I can't expect users to upload a sensible sized image and this can result in hosting huge jpgs that nobody will need to display. I'm also investigating client-side resize with js lib such as FineUploader (see http://docs.fineuploader.com/branch/master/features/scaling.html ) to avoid uploading a big file just to squash it, which would make a lot of sense in a mobile setting.
Drupal 8 is already offering to replace the original image by setting max width and heights on the image field config, so that's why I was expecting Image Optimize to offer to offer it at this level too.
For optimization levels, I tried Kraken's web interface and had impressive results but I'll also look at jpegtran. At the moment, it looks like relying on reSmush.it is not worth the benefits it's offering.
Comment #7
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedFair enough, maybe we should be able to optimize on file upload too.
Comment #8
W.M. CreditAttribution: W.M. commentedI agree this is a pretty handy feature .. I saves time for content authors surely, since the optimization happens on upload & server-side. Hope this will be available for both Drupal 7 and 8. Thank you very much for this valuable module.
Comment #9
juliencarnot CreditAttribution: juliencarnot commentedHere's the Core issue, with a first patch...
Comment #10
Dom. CreditAttribution: Dom. as a volunteer and at ACINO commented@juliencarnot: thanks for the link to this issue. I also second that: I have multiple clients who just upload huge imags (sometimes 10+MB images directly from their camera) and who are not willing to change their contribution flow. This is a nightmare to keep optimized / clever sized image sizes with them.
Comment #11
W.M. CreditAttribution: W.M. commentedAny progress on this? I still believe that such an option should be available.
At the meantime, I am considering running a files watcher which auto optimizes the uploaded images immediately as they get saved to the server.
Comment #12
FR6 CreditAttribution: FR6 as a volunteer commentedI forced the generation of the image styles directly on upload this way:
Hope it helps someone.
Comment #13
mmv93 CreditAttribution: mmv93 commentedYou can use such code to optimize original image:
Comment #14
chikeThanks @mmv93 #13 worked.
In my use case I still need one more help. #13 passes the image through an optimization pipeline so the image got optimized but I equally want to resize the images. This would have been achieved if #12 worked but it didn't work for me likewise all attempts I made to pass the image through an image style. I would appreciate if there is a way to resize the image as well.
Thank you.
Comment #15
mably CreditAttribution: mably commented+1 It would definitely be an interesting feature to have.
@chike this module might be what you are looking for: https://www.drupal.org/project/image_style_on_upload
Comment #16
chikeThank you @mably that's exactly what I am looking for.