Loading...

DrawText has inconsistent results on network files

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

DrawText has inconsistent results on network files

Postby Kin » Tue Jul 14, 2009 11:41 am

Hi

I have encountered an issue with the GdPicture pro control within an VB.net application. We are using the active X control.

When we are using the control to convert to lo-res the then watermark a large quantity of images, which works fine when we use a folder of images on local drives.
The steps we take are:

1) We create an instance of the GdPicture control,
img = CreateObject("GdPicturePro5.Imaging")
img = New GdPicturePro5.Imaging


2) Loop through the list of images we want to convert and watermark

3) With each image, we set the rotation of the image (depending on the orientation Exif data)
For lCount = 1 To img.ExifTagCount
If img.ExifTagGetName(lCount) = "Orientation" Then
Select Case Trim(img.ExifTagGetValueString(lCount))
Case "1" 'None
lRotation = 0
Case "8" 'Right 90
lRotation = 270
Case "3" 'Right 180
lRotation = 180
Case "6" 'Right 270
lRotation = 90
End Select
Exit For
End If
Next lCount


4) Convert the image to lo-res, then rotate as necessary
img.ResizeHeightRatio(lLoResSize, lConversionMode)
Select Case lRotation
Case 90
img.Rotate(GdPicturePro5.RotateFlipType.Rotate90FlipNone)
Case 180
img.Rotate(GdPicturePro5.RotateFlipType.Rotate180FlipNone)
Case 270
img.Rotate(GdPicturePro5.RotateFlipType.Rotate270FlipNone)
End Select


5) Write the watermark then save the file
img.FontSetUnit(GdPicturePro5.UnitMode.UnitPixel)
img.DrawText("Watermark Text", lXPos, lYPos, lFontSize, GdPicturePro5.FontStyle.FontStyleBoldItalic, 1021765350, "Verdana", True)
img.SaveAsJPEG(sLoFileName, 85)



Doing this works fine if we are using local drive files (i.e. C:\Images)

When we do this against a mapped drive (against a network drive), the end result is that the image will be resized/rotated, but no watermark will appear!

I have a workaround, in that I save the the image temporarily after it is resized/rotated, then I load the temporary image before drawing the watermark. This is not ideal, as we will be processing thousands of images a day, and saving thousands of temporary files (then having to delete them) is utilising system resources unnecessarily.

Is this an known issue, that we need to workaround? Or is there a proper fix for this available?

Many thanks for any advice

Kin
Kin
 
Posts: 4
Joined: Mon Jul 13, 2009 5:54 pm

Re: DrawText has inconsistent results on network files

Postby Loïc » Wed Jul 15, 2009 5:37 pm

Hi,

What is the returned value for each of the methods ?

Code: Select all
img.DrawText("Watermark Text", lXPos, lYPos, lFontSize, GdPicturePro5.FontStyle.FontStyleBoldItalic, 1021765350, "Verdana", True)
img.SaveAsJPEG(sLoFileName, 85)


Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: DrawText has inconsistent results on network files

Postby Kin » Thu Jul 16, 2009 1:04 pm

Both methods return 0

Like I've mentioned, the results are inconsistent. Sometimes the watermark appears, othertimes it doesn't.

When the watermark fails, its usually from a master file being loaded from a network location or USB drive, and then the image resized, rotated, watermarked and then the image is then saved to another location.

UPDATE...

The image files being held on a network location doesn't matter. That happened to be a coincidence in our tests.

I've noticed that if the image has a 'Orientation' EXIF tag set, the "img.Rotate(GdPicturePro5.RotateFlipType.Rotate90FlipNone)" method is used, and thats when the DrawText method will not write a watermark afterwards.

Best Regards

Kin
Kin
 
Posts: 4
Joined: Mon Jul 13, 2009 5:54 pm

Re: DrawText has inconsistent results on network files

Postby Loïc » Fri Jul 17, 2009 5:26 pm

Hi Kin,


I've noticed that if the image has a 'Orientation' EXIF tag set, the "img.Rotate(GdPicturePro5.RotateFlipType.Rotate90FlipNone)" method is used, and thats when the DrawText method will not write a watermark afterwards.


This sounds to be an issue related with the exif tag of your image instead of the network access. Please, attach this kind of image and give me real values used as parameter of the DrawText method.

IE:
Code: Select all
img.DrawText("Watermark Text", 100, 100, 10, GdPicturePro5.FontStyle.FontStyleBoldItalic, 1021765350, "Verdana", True)


Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: DrawText has inconsistent results on network files

Postby Kin » Mon Jul 20, 2009 11:20 am

Hi Loïc

I've attached a test image that has the exif tag set. It has orientation tag that would equate to 270 rotation.

For this image, it will be resized, rotated then watermark written.
The actual values passed are:

Code: Select all
img.ResizeWidthRatio(480, 7)
img.Rotate(GdPicturePro5.RotateFlipType.Rotate270FlipNone)
img.DrawText("PicturePortrait", 83, 357, 24, GdPicturePro5.FontStyle.FontStyleBoldItalic, 1021765350, "Verdana", True)


Many thanks

Kin
Attachments
Zoom-Test.jpg
Test file with Exif orientation set
Kin
 
Posts: 4
Joined: Mon Jul 13, 2009 5:54 pm

Re: DrawText has inconsistent results on network files

Postby Loïc » Tue Jul 21, 2009 7:46 pm

Hi,

We've been able to reproduce this problem. This bug should be fixed within 1 month.

Here a workaround:

Add a call to img.ConvertTo24BppRGB just after the image rotation.

With best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: DrawText has inconsistent results on network files

Postby Kin » Wed Jul 22, 2009 10:25 am

Many thanks Loïc!

I will use the workaround until the fix is in place
Kin
 
Posts: 4
Joined: Mon Jul 13, 2009 5:54 pm


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest

cron