-
Notifications
You must be signed in to change notification settings - Fork 62
-
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?
Beta Was this translation helpful? Give feedback.
All reactions
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
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1