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

Adding CMYK Support + adding comments #82

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Calderis
Copy link

@Calderis Calderis commented Apr 1, 2020

Hi,

I'm currently working on a program that is creating printing target and so I need to build CMYK tiff file (yes print industry is still based on tiff format even in 21st century).

So first, thanks for the library ! It helps a lot.

Second, I forked the repo to enhance the library on fews points (including CMYK support) so I might suggest some modification.

You can find my repo at https://github.com/Calderis/UTIF.js and test this fork through yarn add Calderis/UTIF.js#feature/cmyk-support.

Is there some rule to participate to this repo ?


In this pull request:

  • I added some comments to help me understand what's going on
  • I change few syntax for better readability and enhance calcul time
  • I added the possibility to remove default ifd tag by specifying a null value. Eg:
const tifData = UTIF.encodeImage(
  raws[currentPageIndex].data,
  pageWidth,
  pageHeight,
  {
    t338: null  <--------- Here
  }
);
  • I added support for t332 (InkSet) , t334 (NumberOfInks) ifd tag

All this allow you now to create CMYK file by changing the t262 ifd tag to 5 and removing t338 tag.

I might by looking for a LZW compression in the future.

@photopea
Copy link
Owner

photopea commented Apr 1, 2020

Hi, do you also provide a way to specify a color space for the CMYK data, or attach an ICC profile? Or do you just allow storing any channel values between 0 and 255, and the reader can interpret them however they want?

@Calderis
Copy link
Author

Calderis commented Apr 1, 2020

It wasn't in my scope yet to attach a color space to it, since my printing target require especially to be printed without color management.

This is indeed more a way to re-use the actual code and allow you to create cmyk encoded file. There is nothing yet like storing more (or less) than 4 channels (eg: green, orange and so). Only basics. But I might be working on another day.

In the tiff specification, CMYK values are encoded from 0 to 255 by default as well.

I tried this afternoon on the LZW compression without success. I'll try another day.

@photopea
Copy link
Owner

photopea commented Apr 1, 2020

I think I will not merge it, as I think not many people conver to TIFF, and even less people convert to CMYK TIFF. It is not worth it to expand our code for that.

I really think your "printing target" should accept e.g. sRGB images and convert them to their CMYK values themselves.

If you want to add compression, add the Deflate instead of LZW. It is much better.

@Calderis
Copy link
Author

Calderis commented Apr 2, 2020

Alright, I'll continue to develop on my fork. Don't hesitate to contact me if needed ! But tiff files are still used in the printing industry (packaging and so on) so that's still a plus to have it in your software.

I thought that LZW was more relevant since there is a lot of repeated patterns. I'll check for the deflate compression.

Just for information, by "printing target" I was speaking of something like this :

image

This is used to calibrate professionals printers. It could be and RGB or a CMYK file depending of which kind of profile we want to create after that. Those CMYK values are not interpreted by the printing software but used "as it", the main goal is to test the ink distribution (that's why it is so important not to be translated from sRGB values or another color space).

Thanks for all

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.

2 participants