New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make maximum image size configurable #757

Closed
GoogleCodeExporter opened this Issue Apr 6, 2015 · 13 comments

Comments

Projects
None yet
2 participants
@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Apr 6, 2015

What steps will reproduce the problem?
1. Trying to resize an image with ratio 3000x2000

What is the expected output? What do you see instead?

expected resized image - got original


What version of the product are you using (please check X-Mod-Pagespeed
header)?

1.4.26.3-3101

On what operating system?

debian

Which version of Apache?

2.2

Is there any hardcoded limitation of maximum image size while trying to resize 
an image. If yes, this should be a setting in the configuration.

Thanks
Jan


Original issue reported on code.google.com by grasba...@googlemail.com on 30 Jul 2013 at 7:25

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

We currently rewrite images up to 8M (8x1024x1024) pixels. Your image is close 
to, but within the limit, so it must be failed because of other reasons.

Does your image have transparent color (alpha channel), or animation? Did you 
get an 'out-of-memory' error?

Original comment by hui...@google.com on 30 Jul 2013 at 7:43

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

No error seen,

Here is a copy of the image right here: 

http://grasbauer.com/HMT_Motive_sommertheater_2013__132.jpg

One guess: Some exif is encoded in utf-8. Could this be an issue?

Jan


Original comment by grasba...@googlemail.com on 30 Jul 2013 at 8:02

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

I checked the exact size of this image. It turns out that it is slightly over 
the limit. It has 3960x2640 pixels.

Original comment by hui...@google.com on 30 Jul 2013 at 8:09

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Who - bad example ;) Sorry for not checking twice. Is there a setting to 
increase the limit?

Original comment by grasba...@googlemail.com on 30 Jul 2013 at 8:11

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

We don't have an option to change this limit now. But if you compile 
mod_pagespeed from source, you can modify the limit directly. The limit is 
defined in
src/net/instaweb/rewriter/rewrite_options.cc

The current value is:
RewriteOptions::kDefaultImageResolutionLimitBytes = 32*1024*1024;

('kDefaultImageResolutionLimitBytes' / 4) is the maximum number of pixels.

Original comment by hui...@google.com on 30 Jul 2013 at 8:24

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Thanks a lot. Would be a nice feature. There are usecases for intranet or 
similar where the current limit could be to hard ...

Jan

Original comment by grasba...@googlemail.com on 30 Jul 2013 at 8:40

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

One question more:

I have set a higher kDefaultImageResolutionLimitBytes - it worked. But that 
leads me to another question:

If the kDefaultImageResolutionLimitBytes is exceeded, the original src is 
returned but from cache as well (with pagespeed.extension). I think it could be 
better, if the original path is returned, because it isn't handled by 
pagespeed. 

By the way: I didn't find the code where the check 
'kDefaultImageResolutionLimitBytes' / 4
happens.

Original comment by grasba...@googlemail.com on 31 Jul 2013 at 7:50

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

'kDefaultImageResolutionLimitBytes' is checked in
src/net/instaweb/rewriter/image_rewrite_filter.cc

in method:
RewriteResult ImageRewriteFilter::RewriteLoadedResourceImpl()

as follows:
if ((image_width*image_height*4) > options->image_resolution_limit_bytes()) {
...
}

Original comment by hui...@google.com on 31 Jul 2013 at 11:50

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Original comment by jmara...@google.com on 12 Aug 2013 at 6:08

  • Changed state: Started
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Original comment by jmara...@google.com on 1 Oct 2013 at 9:28

  • Added labels: Milestone-v30, release-note
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

In 1.7 you will be able to set 
  ModPagespeedImageResolutionLimitBytes byte_count
and also the default was bumped from 8M to 32M.

Original comment by jmara...@google.com on 2 Oct 2013 at 3:21

  • Changed state: Fixed
@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Update Summary for clarifying the issue.

Original comment by hui...@google.com on 28 Oct 2013 at 3:02

  • Changed title: Make maximum image size configurable
@tomasdev

This comment has been minimized.

Copy link

tomasdev commented Feb 10, 2017

Any chance on plans of making the resize configurable rather than based off user viewport? I.e., if a site contains an image 4000x4000, to be able to specify "maxresizeside = 2000" and that resizes and optimizes to 2000x2000 ? (or 2000x1000 if it were a 6000x3000 original)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment