Skip to content
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

Scaling ratio incorrect? #4

Open
ziriax opened this issue Jul 6, 2016 · 0 comments
Open

Scaling ratio incorrect? #4

ziriax opened this issue Jul 6, 2016 · 0 comments

Comments

@ziriax
Copy link

ziriax commented Jul 6, 2016

The code to compute the scaling ratio is:

  // Calculate scale so we only decode what we need
  if (desiredWidth && desiredHeight) {
    int wdeg = imageWidth / desiredWidth;
    int hdeg = imageHeight / desiredHeight;
    dec.scale_num = 1;
    dec.scale_denom = std::max(1, std::min(std::min(wdeg, hdeg), 8));
  }

However, the following article says:

Just set the desired scaling factor of N/8 (N=1...16) in the djpeg -scale option or via the scale_num/scale_denom variables in library application.

So I guess you should set the scale_denom to 8, and then compute the scale_num so that imageWidth * scale_num / 8 <= desiredWidth?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant