Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, June 1, 2006 2:09:25 AM(UTC)
camelord

Groups: Registered
Posts: 5


Hi,

Is it possible to do the this:

I have 2 CMYK (32bit) Tiff Images and a text.

I want to melt these 2 Image (lets say A.tif and B.tif) to one new CMYK Tiff Image (C.tif).
The Images A.tif and B.tif have to have the same cmyk values like they had before melting them to the new Image C.tif.
Additionally i want to draw a text on Image C.tif (CMYK Tif Image!). This text has to have given cmyk color.

So if i get the CMYK Values: 10,40,10,5 the drawn text has to have this Color on Image C.tif

Is it possible to do this with Leadtools?

Regards

Christian


 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, June 1, 2006 6:46:29 AM(UTC)
camelord

Groups: Registered
Posts: 5


Hi,

i tried to paint a text on a CMYK Tiff Image like this:

 

Leadtools.WinForms.RasterImageViewer riv = new Leadtools.WinForms.RasterImageViewer();

RasterCodecs.CodecsPath = @"C:\leadtool\Bin\Dotnet\v20";

// Intitialize the RasterCodecs object.

RasterCodecs codecs = new RasterCodecs();

// Load the CMYK planes

IRasterImage image = codecs.LoadCmykPlanes( "1.tif", 0, 1 );

// the image passed to this function should contain 4 pages, one for each of the CMYK planes

RasterPaintProperties properties = new RasterPaintProperties();

properties.RasterOperation = RasterPaintProperties.SourceCopy;

Rectangle src = new Rectangle( 0, 0, image.Width, image.Height );

Rectangle dest = new Rectangle( 0, 0, Convert.ToInt32( image.Width / 2 ), Convert.ToInt32( image.Height / 2 ) );

Graphics g = riv.CreateGraphics();

image.PaintCmykPlanes( g, src, dest, properties, null );

Color customColor = Color.Black;

SolidBrush sb = new SolidBrush(customColor);

g.DrawString( "HUHUHU", new Font( "Arial", 20 ), sb, new PointF( 100, 100 ) );

g.Dispose();

// Save the plans as a CMYK TIFF file.

codecs.SaveCmykPlanes( image, "test.tif", RasterImageFormat.TifCmyk, 0, 0, CodecsSavePageMode.Overwrite );

image.Dispose();

 

Unfortunatly nothing happens with the picture. What do i wrong?

 

regards

Christian

 
#3 Posted : Tuesday, June 6, 2006 5:30:50 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Christian,
When you use riv.CreateGraphics(), the resulting graphics object is for the form control, not the image inside it. This means anything you draw there does not change the image's pixel data.

If the 4 CMYK planes are loaded correctly, they will be represented by 4 grayscale images, each of them 8-bit. You need to use the RasterImage.CreateGdiPlusGraphics method for these images and draw on the 4 resulting graphics objects. Note that you will be drawing in the grayscale (RGB) color space, so the actual color in the resulting CMYK will be a combination of the 4 color components you use to draw.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#4 Posted : Wednesday, June 7, 2006 7:44:05 AM(UTC)
camelord

Groups: Registered
Posts: 5


Ok, thx a lot for the hint. Unfortuntly, i am not able to mix the plane Colors to get the correct cmyk Value.

Can you help me a little?

Let´s say, i want to draw a text on the cmyk tiff image with the CMYK Color: C:10 M:60 Y:80 K:27

Can you help me how to draw them a the Grayscale Planes to get this color? Are there Classes in in Leadtools, that help me with that?

 

Regards Christian

 
#5 Posted : Sunday, June 11, 2006 9:24:27 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Christian,
If you managed to create a GDI Plug container for each of the 4 images, and used the DrawString function with each of them, you can control the value by creating a gray brush. For example, drawing on the Y plane would look like this:
containerYPlane.Graphics.DrawString("TEST", font, new SolidBrush(Color.FromArgb(80, 80, 80)), TxtRect);

Where:
containerYPlane is obtained from YPlaneImage.CreateGdiPlusGraphics()
font is of type System.Drawing.Font
TxtRect is of type System.Drawing.RectangleF

The same thing applies for the other planes.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#6 Posted : Sunday, June 11, 2006 10:41:47 PM(UTC)
camelord

Groups: Registered
Posts: 5


I think, you didn´t get my problem. Youre proposal draws any RGB Text on each CMYK Plane. 

My problem is, that i don´t know what Color i get when i melt the four planes to a new CMYK Image with SaveCmykPlanes(..) Function.

Let´s make an example: 

I want a text on a cmyk Image, that has the CMYK value: C:98 M:02 Y:45 K:23

What RGB Color do i have to draw on each plane to get this color.

 

Regards

Christian

 
#7 Posted : Tuesday, June 13, 2006 12:23:03 PM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Christian,
The description I gave you is actually based on the numeric values you gave in your previous post. When you wrote Color: C:10 M:60 Y:80 K:27, I described how to put text with the grayscale value 80 into the Y plane.

For your new example C:98 M:02 Y:45 K:23, the procedure would be:

For the C plane:
containerCPlane.Graphics.DrawString("TEST", font, new SolidBrush(Color.FromArgb(98, 98, 98)), TxtRect);

For the M plane:
containerMPlane.Graphics.DrawString("TEST", font, new SolidBrush(Color.FromArgb(2, 2, 2)), TxtRect);

For the Y plane:
containerYPlane.Graphics.DrawString("TEST", font, new SolidBrush(Color.FromArgb(45, 45, 45)), TxtRect);

For the K plane:
containerKPlane.Graphics.DrawString("TEST", font, new SolidBrush(Color.FromArgb(23, 23, 23)), TxtRect);

The 4 RGB colors (all gray shades) will combine into a CMYK color in the composite image.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#8 Posted : Tuesday, June 13, 2006 9:32:45 PM(UTC)
camelord

Groups: Registered
Posts: 5


Ahh, now i got it. Thanks a lot!!

It worked great..

 

regards

Christian

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.142 seconds.