ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Transparency and PNG

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
bmesser Posted - Nov 25 2013 : 10:37:56
Hi

For a number of days now (or is it weeks), I have been trying to stitch nine PNG images into a 3x3 grid. I have just about used every technique available to man and ImageEN, but have been thwarted at every turn!

The images are small 256x256 coastal outlines, and as far as I can see they have 1 colour (black) and an Alpha channel for transparency. In the latest method I have thought up, I add each image as a new layer that I position in an ImageEnView component, I then merge the layers and save the file as a PNG, the resultant 768x768 image has NO transparency even though the individual file s do.

I have a work round at the moment were I manually use Paint.NET to flood fill the white with transparency, but obviously I would like to do this all in code.

Any help would be very much appreciated.

Bruce.

PS One odd thing about the images are that although they all display fine in Paint & Paint.NET with their transparency intact, they oddly appear black when loaded in IrfanView. If you would like to look at a very simple project and the images you can find the zip file here on my website:

http://www.xmetman.co.uk/StitchGrid.zip


6   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 29 2013 : 12:49:58
quote:
PS Text book formatting by the way!

Everyone swears by CodeComplete, but the book that most made me change my craft was "The Pragmatic Programmer":

http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master-ebook/dp/B000SEGEKI/

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
bmesser Posted - Nov 29 2013 : 01:52:07
Hi Nigel

That works great!

Creating a transparent background did make the difference.

I was beginning to think it wasn't possible to do - so thank you very much for being so helpful.

Bruce.

PS Text book formatting by the way!
xequte Posted - Nov 27 2013 : 15:50:36
Hi

You should find it easier to start with a transparent background and merge your images with that:

procedure TfmMain.CreateTiledImage;
const
  ncols = 3;
  nrows = 3;
var
  col    : integer;
  row    : integer;
  xpos   : integer;
  ypos   : integer;
  path   : string;
  url    : string;
  ABitmap: TIEBitmap;
begin
  Screen.Cursor := crHourGlass; 
  ABitmap := TIEBitmap.create;
  try
    ImageEnView1.LegacyBitmap := False;
    ImageEnView1.IEBitmap.Width  := 3*256;
    ImageEnView1.IEBitmap.Height := 3*256;
    ImageEnView1.EnableAlphaChannel := True;
    ImageEnView1.AlphaChannel.Fill(0);

    ypos := 0;
    for row := 0 to 2 do
    begin
      xpos := 0;

      for col := 0 to 2 do
      begin
        path := Format('Image%d%d.png',[col,row]);
        ABitmap.Read(path);
        ImageEnView1.IEBitmap.MergeWithAlpha(ABitmap, xpos, ypos);

        inc(xpos, 256);
      end;

      inc(ypos,256);
    end;     

    ImageEnView1.Update;

    if ImageEnView1.HasAlphaChannel = False then
      raise Exception.create('No Alpha channel!');

    ImageEnView1.IO.SaveToFilePNG('Image.png');
  finally
    Screen.Cursor := crDefault;
    ABitmap.free;
  end;
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Ruekaka Posted - Nov 26 2013 : 08:28:08
Just because I'm also following this thread: The images are in the attached zip file.

With kind regards,
Ruediger Kabbasch
w2m Posted - Nov 26 2013 : 07:41:21
Email Nigel and Fabrizio a few of the images.

William Miller
bmesser Posted - Nov 26 2013 : 06:30:23
Fabrizio

I have run one of the PNG images through PNGCheck (http://sourceforge.net/projects/png-mng/) and according to that it's a valid 8-bit non-interlaced image.

Bruce.