Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Eric  
#1 Posted : Thursday, July 26, 2007 11:24:17 PM(UTC)
Eric

Rank: Member

Groups: Member
Joined: 7/26/2007(UTC)
Posts: 3

I need to put some text on a 1bpp CCITT4 tiff file. Since this can't be done directly, I had to ConvertTo24bppRgb(), DrawText() and finally convert it back ConvertTo1bppIndexed(). After I SaveToFile() and load the file in a viewer (ex. Paint), the colors are inverted. Is this normal? Do I have to Invert() the image every time?

Thanks.

Dmitry  
#2 Posted : Monday, July 30, 2007 4:32:49 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello,

Could you post complete code sample which you use to draw text here?

Sincerely yours,

Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!

Eric  
#3 Posted : Thursday, August 2, 2007 3:49:34 AM(UTC)
Eric

Rank: Member

Groups: Member
Joined: 7/26/2007(UTC)
Posts: 3

Here's the code in VFP:

Code:

WITH THISFORM.BitmapViewer.Bitmap
    lcMyFile = 'myfile.tif'         && 1bpp file
    .LoadFromFile(lcMyFile)

    .FormatAutoSelect = .F.
    .Unit = 2
    .Graphics.TextFormat.FontName = 'Arial'
    .Graphics.TextFormat.FontColor = 0
    .Graphics.TextFormat.FontSize = .1
    lnImgWidth = .Data.ScaleWidth
    lnImgHeight = .Data.ScaleHeight / 2
    .Data.ConvertTo24bppRgb()

    lcString = 'This is a test'
    lnTxtWidth = .Graphics.TextFormat.MeasureTextWidth(lcString) / 2
    .Graphics.DrawText(lcString, lnImgWidth - .74, lnImgHeight - lnTxtWidth, 90)

    .ColorAdjustment.Invert()
    .Data.ConvertTo1bppIndexed()
    .Formats.SelectCurrent('TIFF')
    .Formats.TiffCompressionType = 5
    .SaveToFile(lcMyFile)
ENDWITH

Thanks,

Eric

Tanya  
#4 Posted : Thursday, August 2, 2007 4:48:13 PM(UTC)
Tanya

Rank: Advanced Member

Groups: Member
Joined: 5/14/2007(UTC)
Posts: 24

Was thanked: 1 time(s) in 1 post(s)
Hello Eric,

Thank you for reporting us about this problem. It appears a bug. We will fix it in the further release.

You may additionally use Invert method as a workaround.

Best regards,

Tatyana Bertyakova

Best regards,

Tatyana Bertyakova

UserPostedImage Follow Aurigma on Twitter!

Users browsing this topic
Guest (7)
Forum Jump  
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.