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

Implemented Lossless JPEG support for TinyDngWriter #23

Merged

Conversation

storyboardcreativity
Copy link
Contributor

  • Added lj92 compressor code
  • Added COMPRESSION_NEW_JPEG constant for lossless JPEG compression mode
  • Added SetImageDataJpeg method (it now allows setting image data with compression)

- Added lj92 compressor code
- Added COMPRESSION_NEW_JPEG constant for lossless JPEG compression mode
- Added SetImageDataJpeg method (it now allows setting image data with compression)
- Fixed lj92_encode parameter (readLength)
@syoyo
Copy link
Owner

syoyo commented Nov 1, 2022

Awesome! Is there an example to use LosslessJPEG compression? Simply replace SetImageData with SetImageDataJpeg?

@syoyo syoyo merged commit 0490c9e into syoyo:master Nov 1, 2022
@syoyo
Copy link
Owner

syoyo commented Nov 1, 2022

Anyway merged! Thanks!

BTW SetImageDataJpeg is confusing. I may change it to SetImageDataAsLosslessJpeg.

@storyboardcreativity
Copy link
Contributor Author

Awesome! Is there an example to use LosslessJPEG compression? Simply replace SetImageData with SetImageDataJpeg?

Here is an example:

bool compressed = true;
tinydngwriter::DNGImage dng_image;

// ...

if (compressed)
    dng_image.SetCompression(tinydngwriter::COMPRESSION_NEW_JPEG);
else
    dng_image.SetCompression(tinydngwriter::COMPRESSION_NONE);

// ...

if (compressed)
    dng_image.SetImageDataJpeg(data, wdith, height, bpp);
else
    dng_image.SetImageDataPacked(data, count, bpp, big_endian);

You can see working code in my repo (ZRAW Video Converter):
https://github.com/storyboardcreativity/zraw-parser/blob/2e32a9bc9be1d9ec91aeb633967cdf87e3e2972f/src/ZrawConverterThread.hpp#L215

@syoyo
Copy link
Owner

syoyo commented Nov 1, 2022

@storyboardcreativity Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants