Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Lossless JPEG -> JXL transcoding question #380

Answered by jcupitt
dkam asked this question in Q&A
Discussion options

Hi there - I'm trying to do some lossless transcoding from JPEG to JXL. Neither lossless: true nor Q: 100 seem to do this though:

# dd37cb7288d69c05.jpg -> 738K
Vips::Image.new_from_file('dd37cb7288d69c05.jpg').jxlsave('dd37cb7288d69c05_vips.jxl', Q: 100)
# dd37cb7288d69c05_vips.jxl -> 2.1M
Vips::Image.new_from_file('dd37cb7288d69c05.jpg').jxlsave('dd37cb7288d69c05_vips.jxl', lossless: true, Q: 100)
# dd37cb7288d69c05_vips.jxl -> 3.7M 
Vips::Image.new_from_file('dd37cb7288d69c05.jpg').jxlsave('dd37cb7288d69c05_vips.jxl', lossless: true)
# dd37cb7288d69c05_vips.jxl -> 3.7M 
`cjxl dd37cb7288d69c05.jpg dd37cb7288d69c05_cjxl.jxl --lossless_jpeg=1`
# dd37cb7288d69c05_cjxl.jxl => 658K

Is it because Vips is loading the file into an internal format so it doesn't know to do a lossless transcode? Is there a way to get Vips to do lossless Jpeg->Jxl transcoding?

You must be logged in to vote

Hi @dkam,

Like (I think?) all image processing libraries, libvips always decompresses to pixel values then recompresses, so it can't do this kind of direct transform. You need to use the libjxl tools for this.

libjpeg has a similar thing -- it can do very fast lossless crop and rotate of JPEG images (as long as you stick to 8 pixel boundaries), but there's no way you can expose functionality like that in an image processing library, you have to use the libjpeg tools.

Replies: 1 comment

Comment options

Hi @dkam,

Like (I think?) all image processing libraries, libvips always decompresses to pixel values then recompresses, so it can't do this kind of direct transform. You need to use the libjxl tools for this.

libjpeg has a similar thing -- it can do very fast lossless crop and rotate of JPEG images (as long as you stick to 8 pixel boundaries), but there's no way you can expose functionality like that in an image processing library, you have to use the libjpeg tools.

You must be logged in to vote
0 replies
Answer selected by dkam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /