compress uploaded images in magento - image

Is it possible to compress the original product image on upload in magento?
Magento saves the original uploaded image in full size.
The store admin have 3MB images and 20K products.
I want to automatically resize the images to ~150K.
Thanks

Magento automatically re-compresses product images before displaying them on the frontend.
Due to the nature of compression techniques you cannot easily target a specific file size as it depends a lot on the amount of detail in a picture. A plain "large" (wide and tall) image can result in a smaller file than a complex "small" (narrow and short) image. First check the file sizes being served to customers and then decide if it's worth pursuing.

If you really have to do the resizing through the admin, you might be able to tie into the event observer for the product save and write a script to reduce the size of the original image.

It may be fastest to use Photoshop or some related to resize the images to the largest useful size for the store. This should be a relatively small JPG, and will largely obviate the issue. As a side benefit, uploading new images will be many times faster.

Related

Reducing .jpeg PFFiles stored on Parse.com

I have an app running on parse.com backend, with users that creates profiles.
The format is jpeg and the resolution is 640X640.
I've noticed that some photos weights 150KB and other can reach to 500KB.
I want to optimize and reduce the images size without hurting image quality as much via image compression.
I've looked at
https://parse.com/docs/cloudcode/guide#cloud-code-modules
And it seems that the Image module only have crop and resize features. no compression.
How can i reduce the size of the stored jpeg without changing the reference from the object?
Sure i will need a background job... I just need help in figuring how to do it, and any things i need to worry about as the app is live with growing amount of users.
Thanks!

How to optimize images for SEO & Google's Pagespeed & Improve web-saving

Pretty much with every Pagespeed test I do for all my website I get the comment "Optimize images by lossless compressing image X" which often increases my page rank a lot.
I already save EVERY image with 'save for web' with Photoshop, but I was wondering how I could "Optimize images by compressing lossless" even more. As far as I know I'm already doing everything I can.
Really wondering..
Off-topic, but I noticed that Google's PageSpeed uses a Retina device to check, since all my Retina images got loaded instead of the regular ones. Since these are larger than the area I got a 1/100 score on the mobile segment. Haha.
This was a real issue with many of my sites, however I use the free version of kraken to 'loosely compress' all of my images and this passes the Google Test, thus boosting rankings!
https://kraken.io/web-interface
I must have used this for well over 10,000 images already!
The images you create in programs like Photoshop and Illustrator look amazing but often the file sizes are very large. This is because the images are made in a format that makes them easier to manipulate in different ways. If you put these files on your website it would be very slow to load. Optimizing your images for the web means saving or compiling your images in a web-friendly format depending on what the image contains.
How does it work?
There are two forms of compression that we need to understand, Lossy and Lossless.
Images saved in a lossy format will look slightly different than the original image when uncompressed. Keep in mind that this is only visible at a very close look. Lossy compression is good for web, because images use a small amount of memory, but can be sufficiently like the original image.
Images saved in lossless format retain all the information needed to produce the original image. For this reason, these images carry a lot more data and in return are a much large file size.
We also can optimize images for the web by saving them as the appropriate dimensions. Resizing the image on the webpage itself using CSS is helpful but the issue is the web browser will still download the entire original file, then resize it and display it.
Can you imagine taking a poster size image and using it as a thumbnail? The little 20px by 20px image would take as long to load as the original poster when we could just be loading a 20px image the whole time.
How to Optimize Images?
In simple terms optimizing your image works by removing all the unnecessary data that is saved within the image to reduce the file size of the image based on where it is being used in your website. Optimizing images for the web can reduce your total page load size by up to 80%.
Full optimization of images can be quite an art to perfect as there are such a wide variety of images you might be dealing with. Here are the most common ways to optimize your images for the web.
Reduce the white space around images – some developers use whitespace for padding which is a big no-no. Crop your images to remove any whitespace around the image and use CSS to provide padding.
Use proper file formats. If you have icons, bullets, or any graphics that don’t have too many colors use a format such as GIF and save the file with lower amounts of colors. If you have more detailed graphics then use JPG file format to save your images and reduce the quality.
Save your images in the proper dimensions. If you are having to use HTML or CSS to resize your images, stop right there. Save the image in the desired size to reduce the file size.
To resize your images you will have to use some form of program. For basic compression, you can use a simple editing program such as GIMP. For more advanced optimization you will have to save specific files in Photoshop, Illustrator, or Fireworks.

How to show different size images on a site with lots of images

For an image intensive size like 500px, flickr, instagram etc which serve lots of images with different sizes and users constantly upload images whats the best way to store and display different size images.
Same image is usually displayed in different sizes, like thumbnail, modal window size and big size etc (like on ecommerce sites).
Also for dynamic size grids like http://500px.com/flow where images are all dynamic sizes spanning multiple rows and columns.
Do these sites create all these different sizes and store different version of site or its done on the fly?
Usually, these sites create a few versions of the image when they are uploaded. Common examples are small (thumbnail), medium, large, full-size. These transformations are done at upload-time, as there is a large performance penalty of resizing so many images on the fly.

Is there a pattern or ratio for jpg image filesize in relation to image size?

I'm trying to optimize a page which loads a lot of images from S3 and which needs to run on mobile devices, too.
Images are available in S,M,L,XL resolutions, so on a smartphone I'm usually pulling Size M for the grid thumbnail images. These pictures measure: 194x230px and usually "weigh" around 20k, which I think is far too much.
Question:
If I use Irfan and the RIOT plugin, I can easily shave off 10k from the filesize with the image still looking ok. I'm wondering if there are any guidelines regarding optimal image filesize in relation to image dimensions or is this purely a trial and error process? As a side question, is there any server-side tool, which also uses the RIOT plugin?
Thanks!

What is the best way to dynamically resize images?

The problem:
We have large product images we want thumbnails of at various size but don't want to be stuck batch processing the images in Photoshop. We want a dynamic way or resizing images, that wont add an extra load time while the images is processing on the backend.
Amazon does this some how with their ecommerce solution. When you upload an image it resizes the image in square format and then gives you every size imagineable. ex 150x150, 149x149, etc. Starting at the largest size of the image, so if you upload a 1024x900 image it will resize it to 1023x899, 1023x1203 (add in white space where needed), then resize every pixel until it gets to 1x1px. The some how stores all the images to the server (if it even does that)
"there's got to be a better way"
Any suggestions on the best way to handle image resize on the fly?
Dynamic image processing can be incredibly fast, and it's a much better solution than generating every possible combination of sizes for an uploaded image.
The open-source ImageResizing.Net library allows dynamic crop/zoom and resizing, and with the WIC plugin can often have round-trip times of less than 20ms. That's hard to beat. It also offers disk caching and Amazon CloudFront & S3 support if you want to scale with the big folks. It's used by 20K-60K websites, and some servers host upwards of 20TB of images.
I'm pretty sure Amazon uses cached dynamic image resizing for their eCommerce solution. Pre-generating image versions is a very 2001-era solution.
[full disclosure: I'm the author.]

Resources