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 : Sunday, November 19, 2006 8:46:31 PM(UTC)
shafrick

Groups: Registered
Posts: 9


On my TIFF file. I need to put some annotation with red color. During opening of the TIFF file I convert the TIF file into bmp by adding below command

LEAD1.ColorMerge

Then I save it. The problem now is that the pixels didn't change but DPI value change from 200DPI (original) to 150DPI. Same goes to the bitmapsize it change to a bigger file size

If I didn't put "LEAD1.ColorMerge" the TIF file output will be in blank and white.

How could I maintain to the original DPI value with the colored TIF file.

 

Below is my code for your reference

If LEAD1.BitmapCompression = 1 Then
       
        LEAD1.ColorSeparate COLORSEP_RGB
        LEAD1.ColorMerge COLORSEP_RGB
        LEAD1.ForceRepaint      

End If

 

Regards,
.shafrick

 

 

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 : Sunday, November 19, 2006 11:24:20 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

Can you please send me the TIFF file that you use? What is the BPP of the TIFF file?
What is the exact LEADTOOLS version that you use?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Sunday, November 19, 2006 11:35:22 PM(UTC)
shafrick

Groups: Registered
Posts: 9


You can download the tif file at

www.simpleadvantage.com/tif/before.tif

www.simpleadvantage.com/tif/after.tif

Currently I'm using Leadtools ver 14.1

.shafrick

 
#4 Posted : Monday, November 20, 2006 12:12:04 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

I checked your TIFF file (before.tif) and noticed that it's 1 BPP. You can simply change the color depth of the file to 24 bit by using the LEAD1.ColorRes method, which converts the bitmap from any bits-per-pixel to any bits-per-pixel, letting you specify the palette to use. Please try to use the ColorRes method instead of using theColorSeparate and ColorMerge methods and let me know how it goes.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Monday, November 20, 2006 1:56:37 AM(UTC)
shafrick

Groups: Registered
Posts: 9


I've followed your idea to use the LEAD1.ColorRes but the output from red turn to blue. Why?

Below is the code that I used

If LEAD1.BitmapCompression = 1 Then
    LEAD1.ColorRes 32, CRP_OPTIMIZEDPALETTE, CRD_NODITHERING, 0
    LEAD1.ForceRepaint    
End If

www.simpleadvantage.com/tif/before.tif

www.simpleadvantage.com/tif/after.tif

Please correct it if it's wrong. Really appreciate that

.shafrick

 

 

 
#6 Posted : Monday, November 20, 2006 4:22:54 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

The correct syntax as follows:
LEAD1.ColorRes 24, CRP_BYTEORDERBGR, CRD_NODITHERING, 0

Please let me know if this helps.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#7 Posted : Monday, November 20, 2006 6:34:58 AM(UTC)
shafrick

Groups: Registered
Posts: 9


Thank you Maen... It's works. Your are so genius. Really appreciate that

Anyway, what is the best compression methos for colored TIF file instead of LZW?

.shafrick

 
#8 Posted : Tuesday, November 21, 2006 12:30:04 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

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

Shafrick,
There is support for different types of compression in TIFF files in LEADTOOLS, but the most suitable one depends on your application.
LZW usually gives good compression and has 2 other advantages:
1. It is lossless, which means all pixel values remain unchanged when you save them.
2. It is fairly common, which allows many non-LEAD programs to read the file.

Other compression types and their main features include:
- Packbits: lossless, but usually larger output size than LZW.
- JPEG: can produce small images, but is lossy. This means the more you compress it, the more color information will be lost.
- Lossless JPEG: No color information is lost, but file is not very small, and most other programs cannot read it.
- CMP: Lossy like JPEG, and only LEADTOOLS can read it.
- JPEG 2000 and Wavelet CMP: Both can produce very small size, but are lossy, most other programs cannot read it.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#9 Posted : Thursday, November 23, 2006 9:59:31 PM(UTC)
shafrick

Groups: Registered
Posts: 9


The colormerge issue has been resolved by changing the method to colorres.Thanks Maen for the solution. Anyway, another problem that I'm facing now is that all files that has been open up from the old application before using colorres has been changed.

Below is the comparision before and after the conversion

http://www.simpleadvantage.com/tif/before.tif
Before: (Original)
Image Length: 3508 (11.69inch)
Image Width : 4961 (16.54inch)
Resolution (X): 300 DPI
Resolution (Y): 300 DPI

http://www.simpleadvantage.com/tif/after.tif
After:
Image Length: 3508 (23.39inch)
Image Width : 4961 (33.07inch)
Resolution (X): 150 DPI
Resolution (Y): 150 DPI

I need help, how could I get back the original setting. I tried using below code by open up the after.tif and save the file but I noticed that I can only get back the original inch but not the pixels and the DPI. The pixels change to 1754 pixels(11.69 inch), 2480 pixels (16.53inch)
http://www.simpleadvantage.com/tif/new.tif

    nFormat = FILE_TIF_PACKBITS
    nBits = 24              ' 8 bits
    nQFactor = 2            ' QFactor ??
    FileName = sPath & sFName & ".TIF"
    LEAD1.Size LEAD1.BitmapWidth / 2, LEAD1.BitmapHeight / 2, 0
    LEAD1.Save FileName, nFormat, nBits, nQFactor, 0

Please help

 

 
#10 Posted : Saturday, November 25, 2006 11:36:12 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

Top resolve the problem, try to set the BitmapXres and BitmapYres to 300 DPI before saving the file as follows:
------------------------
...
LEAD1.Size LEAD1.BitmapWidth / 2, LEAD1.BitmapHeight / 2, 0
Lead1.BitmapXres = 300 Lead1.BitmapYres = 300
LEAD1.Save FileName, nFormat, nBits, nQFactor, 0
------------------------

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#11 Posted : Sunday, November 26, 2006 4:39:51 AM(UTC)
shafrick

Groups: Registered
Posts: 9


Dear Maen

It works...thanks alot

 

.shafrick

 
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.434 seconds.