I have an image that I want to re-scale the size so that the file size will be small. By using libjpegturbo class TJScalingFactor
and TJCompressor
, I am still unable to re-scale the image as there is no method which allow height and width to be inputted.

- 4,977
- 3
- 34
- 53

- 11
- 2
-
Anyone know how to solve it? – user2854466 Oct 08 '13 at 02:37
-
i am able to use TJScalingFactor class to .getscaled() both height and width but there is no method in TJCompressor that require the input of the height and width. – user2854466 Oct 08 '13 at 08:10
1 Answers
This problem seems to be somehow related to this question, where the OP wants to compress, decompress and compress an image to scale it. This question is also talking about scaling while decompressing, what can in fact be done with the TurboJPEG API.
This part contains background information
In fact, scaling while compressing was only introduced and implemented in the version 7 of the Independent JPEG Groups libjpeg. The developer of TurboJPEG and libjpeg-turbo has doubts about the usefulness of this new function, why he does not see any reason to implement it. Also, the project page says: "It can also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8, but it does not include support for the non-standard SmartScale format introduced in libjpeg v8."
TL;DR;
Use TJCompressor
to compress the image, decompress it with the wished width/height using TJDecompressor
and compress it again using TJCompressor
.