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 : Saturday, April 5, 2008 8:50:29 PM(UTC)

c-horse  
c-horse

Groups: Registered
Posts: 5


Hello,

I think there is a problem with L_LoadLayer. If you use the attached PSD and run the sample code for L_LoadLayer and specify layer 1, the resulting bitmap is corrupted.

Thanks in advance for your help.

-- Fred
 

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 : Saturday, April 5, 2008 9:58:13 PM(UTC)

c-horse  
c-horse

Groups: Registered
Posts: 5


Sorry... new here. Admin, please delete that new thread I started by mistake.

Having trouble uploading so here's a link to the file mentioned above:

www.c-horsesoftware.com/TURTLE-black-rgb.psd

Thanks

-- Fred
 
#3 Posted : Sunday, April 6, 2008 9:45:28 PM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,028

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

Fred,

Can you tell me what version of LEADTOOLS you are using? And what is the build number (version info) of the Lfpsd???.dll installed on your computer?
 
#4 Posted : Monday, April 7, 2008 12:01:33 PM(UTC)

c-horse  
c-horse

Groups: Registered
Posts: 5


It is version 15. How do I get the build number?

-- Fred
 
#5 Posted : Tuesday, April 8, 2008 6:24:18 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,028

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




To get
the build number for LEADTOOLS DLLs, right-click-> properties on the DLL, go to the version tab and check the number there.


About
the issue it self, can you tell me how exactly the PSD file layer appears to be
corrupted? Can you send me a screen shot of the corrupted layer display and the correct display?






If you
mean that the transparency information is not automatically handled, this is
the normal behavior for LEADTOOLS when handling images that contain Alpha
channels. We do not translate Alpha to Transparency automatically like some
other applications do. If you want to apply transparency, load the layer as
32-bit, and see the following post to get more information about applying the alpha channel transparency:
http://support.leadtools.com/SupportPortal/cs/forums/2572/ShowPost.aspx


Note that for the DLL API, the function name is L_FeatherAlphaBlendBitmap
 
#6 Posted : Tuesday, April 8, 2008 10:14:26 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


I noticed that you posted the same problem on the forum as I was working with you via email, so I'm posting the resolution here in case someone else runs in to the same problem.

As far as I can tell, the problem is the transparency.  You have to do a little more work to let LEADTOOLS know that an image has transparency.  The LAYERINFO structure has a pMaskBitmap property which you must set with L_GetBitmapAlpha if you want the image to look correct.  Otherwise LEADTOOLS fills in the gaps.

I've attached a small sample project which is a modification of the example for L_SaveBitmapWithLayers.  I've also attached screenshots of the resulting files.  As you can see, they look identical in both the LEADTOOLS main demo and Photoshop 7.  The only difference I can see are the additional channels which your original file had.  LEADTOOLS will only save the RGB channels and transparency information.

You can find the PSD file used in the example from here:

http://www.c-horsesoftware.com/Explosive_BKB_925-tweaked-test1.psd
File Attachment(s):
files.zip (546kb) downloaded 20 time(s).
 
#7 Posted : Wednesday, March 18, 2009 7:49:21 AM(UTC)

m_alexm  
m_alexm

Groups: Registered
Posts: 2


Hi,
I tried your sample with the attached PSD file and it is not working. Please have a look.

Thank you,

Mihai
 
#8 Posted : Wednesday, March 18, 2009 7:51:58 AM(UTC)

m_alexm  
m_alexm

Groups: Registered
Posts: 2


The attachment ...
File Attachment(s):
Un1.zip (442kb) downloaded 18 time(s).
 
#9 Posted : Thursday, March 19, 2009 7:25:16 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


This was just a very simple sample project that was hard-coded for a single layer PSD while yours has two layers.  For multiple layers you need to use an array of LAYERINFO structures.  Here's the modified code snippet that will work for your file:


L_INT CTestDlg::SaveBitmapWithLayersExample(L_TCHAR *szFileName)
{
   L_INT nRet;
   BITMAPHANDLE Bitmap;
   HBITMAPLIST hLayers;
   L_INT nLayers = 2;
  
   nRet = L_CreateBitmapList(&hLayers);
   if(nRet != SUCCESS)
      return nRet;

   // initialize an array of LAYERINFOs
   LAYERINFO layerInfo[2];
   memset(&layerInfo, 0, sizeof(LAYERINFO) * 2);
   layerInfo[0].uStructSize = sizeof(LAYERINFO);
   layerInfo[1].uStructSize = sizeof(LAYERINFO);

   // load the first layer
   nRet = L_LoadLayer(szFileName, &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, 0, &layerInfo[0], NULL);
   if(nRet != SUCCESS)
      return nRet;

   // Set the transparency mask for the first layer
   layerInfo[0].pMaskBitmap = (pBITMAPHANDLE)GlobalAlloc(GPTR, sizeof(BITMAPHANDLE));
   nRet = L_GetBitmapAlpha(&Bitmap, layerInfo[0].pMaskBitmap, sizeof(BITMAPHANDLE));

   nRet = L_InsertBitmapListItem(hLayers,(L_UINT)-1, &Bitmap);
   if(nRet != SUCCESS)
      return nRet;
  
   // load the second layer
   nRet = L_LoadLayer(szFileName, &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, 1, &layerInfo[1], NULL);
   if(nRet != SUCCESS)
      return nRet;

   // Set the transparency mask for the second layer
   layerInfo[1].pMaskBitmap = (pBITMAPHANDLE)GlobalAlloc(GPTR, sizeof(BITMAPHANDLE));
   nRet = L_GetBitmapAlpha(&Bitmap, layerInfo[1].pMaskBitmap, sizeof(BITMAPHANDLE));

   nRet = L_InsertBitmapListItem(hLayers,(L_UINT)-1, &Bitmap);
   if(nRet != SUCCESS)
      return nRet;


    /* Load the bitmap that is made up of all the layers */
   nRet = L_LoadBitmap (szFileName, &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;

   /* Save this bitmap and all the layers */
   nRet = L_SaveBitmapWithLayers(TEXT("d:\\junk folder\\image.psd"), &Bitmap, FILE_PSD, 0, 0, hLayers, layerInfo, nLayers, NULL);
   if(nRet != SUCCESS)
      return nRet;

   /* Free the bitmap */
    if(Bitmap.Flags.Allocated)
        L_FreeBitmap (&Bitmap);

   /* Free the layers bitmap list and all the bitmaps contained in it */
   L_DestroyBitmapList(hLayers);

   return SUCCESS;
}

 
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-2020, Yet Another Forum.NET
This page was generated in 0.296 seconds.