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

encodeImage no support for compression #121

Open
varun-raghavendra opened this issue Jul 31, 2023 · 6 comments
Open

encodeImage no support for compression #121

varun-raghavendra opened this issue Jul 31, 2023 · 6 comments

Comments

@varun-raghavendra
Copy link

UTIF.encodeImage currently encodes a new Tiff with no compression. This blows up the size of the output TIFF.

Is there a plan to support different compressions like LZW, G4, etc for encodeImage?

Also, could you provide any pointers to build my own image encoder with compression? Unsure how to start off with this.

@varun-raghavendra
Copy link
Author

varun-raghavendra commented Jul 31, 2023

@jardicc, You've mentioned in the below issue that it shouldn't be hard to use existing compression while encoding new Tiff image. Could you elaborate?

[@jardicc] (#102 (comment))

@jardicc
Copy link

jardicc commented Jul 31, 2023

It was in 2021. I was able to do that for my project. But I would need to spend some time to recall the details. Utif can decode compressed pixels so you would do the same but with encoding.

@photopea
Copy link
Owner

If you need to store compressed images, I recommend you to use the PNG format instead of TIFF. The PNG is a better format, and it is supported pretty much everywhere.

You can use our library https://github.com/photopea/UPNG.js

@jardicc
Copy link

jardicc commented Jul 31, 2023

We already had this discussion before. TIFF can support all features as PSD due to Adobe's proprietary section + much more. You can even replace PSD with TIFF and produce smaller files due to better bitmap compressions. PNG is just a flat image ¯_(ツ)_/¯

If you would use PNGs to recreate layers functionality then you would be reinventing a new image format because you would need some "glue".

If I remember correctly to support compression in UTIF... you would need to write about 5 lines of code?

@photopea
Copy link
Owner

"TIFF can support all features as PSD due to Adobe's proprietary section" you are suggesting to make files, which have the "tiff" extension, but are openable only in Adobe Photoshop.

I really dont recommend to do so. You should use the PSD, if you want layers. PSD files can be opened in more programs, even in some free programs.

@varun-raghavendra
Copy link
Author

@jardicc, could you recall what you did in 2021 for your project? Any code reference would be helpful.

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

3 participants