Board index » delphi » Free components/units to deal with PNG format

Free components/units to deal with PNG format

Please, anyone knows any free component or delphi unit to load PNG files ??
thx
 

Re:Free components/units to deal with PNG format


go to efg's computer in th file conversion page and there you will find a
library and object to load png files

Best regards
johnnie

Quote
Gustavo Daud wrote:
> Please, anyone knows any free component or delphi unit to load PNG files ??
> thx

Re:Free components/units to deal with PNG format


Hi all,
I have a problem with loading Images from Stream.
Image after loading from Stream is present, but not visible, even if the
property Visible is true and Parent is Self. I tried to call Invalidate and
Update for this Image but with no effect.

Code:
  ...
  { Create stream object in read-only mode }
  Stream := TFileStream.Create(fileName, fmOpenRead);
  try
    Image1 := TImage(Stream.ReadComponent(nil));  { Read & Create B }
    Image1.Parent := Self;                        { Assign parent }
    Image1.Visible:=true;                          { Visibility }
    // Image1.Invalidate;                             { It has no effect
-( }
    // Image1.UpDate;
  finally
    Stream.Free;  { Destroy the file stream object }
  end;
  ...

Can anyone help me, please?

Thanx,
                     Petr Selinger, selin...@sl.inext.cz

Re:Free components/units to deal with PNG format


Hi all,
Could anyone advise me a method for storing an Images for my application?

I don`t want to use Resource files, because they`re linked to exe file and
it takes more space - my app is about 14Mb now

I`m loading them from disk now, but anybody can simply edit them. I tried to
load them from Stream, but it doesn`t work (see my other mail). I need also
fast redrawing, because the Images are used like a background of a form and
it doesn`t look good if you must wait for them.

Can anyone help me, please?

Thanx,
                     Petr Selinger, selin...@sl.inext.cz

Re:Free components/units to deal with PNG format


Quote
Petr Selinger <selin...@sl.inext.cz> wrote in message

news:7qtffa$mii13@forums.borland.com...

Quote
> I have a problem with loading Images from Stream.

Peter Below posted some code on how to save and retrieve a
bitmap using streams.  His post has a SaveBitmapToStream
and a LoadBitmapToStream:

http://www.deja.com/[ST_rn=qs]/getdoc.xp?AN=471624255
(be sure to use the whole line above to retrieve this post from Deja)

Instead of working with a  TImage, I'd suggest loading the
bitmap from the stream and then displaying the TBitmap
in a TImage:

   Image.Picture.Graphic := Bitmap;

___
efg

Earl F. Glynn     E-Mail:  EarlGl...@att.net
Overland Park, KS  USA

efg's Computer Lab:  http://www.efg2.com/Lab

Re:Free components/units to deal with PNG format


Hello Petr,

loading images from streams works perfectly, this might be a bug
in your code. I'm using it myself without any problem for most of
my own programs.
Maybe it helps if you post some meta- (or real) code how you do it.

Richey

On Sun, 5 Sep 1999 12:13:40 +0200, "Petr Selinger"

Quote
<selin...@sl.inext.cz> wrote:
>Could anyone advise me a method for storing an Images for my application?
>I don`t want to use Resource files, because they`re linked to exe file and
>it takes more space - my app is about 14Mb now
>I`m loading them from disk now, but anybody can simply edit them. I tried to
>load them from Stream, but it doesn`t work (see my other mail). I need also
>fast redrawing, because the Images are used like a background of a form and
>it doesn`t look good if you must wait for them.

----------------------------------------------------------------
http://Inner-Smile.com, home of:
INF-Tool - create *smaller* setup packages for your programs!
Resource-Grabber - giving you 1000's of glyphs,images,icons,sounds..
Richey's Delphi-Box - 1000+ links and answers for Delphi developers
..one of the best starting points for Delphi developers worldwide..

Re:Free components/units to deal with PNG format


Hi all,
Could anyone advise me a method for storing an Images for my application?

I don`t want to use Resource files, because they`re linked to exe file and
it takes more space - my app is about 14Mb now

I`m loading them from disk now, but anybody can simply edit them. I tried to
load them from Stream, but it doesn`t work (see my other mail). I need also
fast redrawing, because the Images are used like a background of a form and
it doesn`t look good if you must wait for them.

Can anyone help me, please?

Thanx,
                     Petr Selinger, selin...@sl.inext.cz

Re:Free components/units to deal with PNG format


Quote
> I don`t want to use Resource files, because they`re linked to exe file and
> it takes more space - my app is about 14Mb now

you could use DLL's, though the total size wouldn't change much. are you
using compressed formats (jpg, gif)?

Quote
> I`m loading them from disk now, but anybody can simply edit them. I tried to

well, anybody could also delete your executable :)

Quote
> load them from Stream, but it doesn`t work (see my other mail). I need also

it's the parent business. so, I guess, you're dumping your bitmaps into
a large resource file type thing, am I right?

Quote
> fast redrawing, because the Images are used like a background of a form and
> it doesn`t look good if you must wait for them.

depends on what you have in the foreground. for example, I'm using a
TImage in the background, TShapes as block objects and a TPaintBox for
drawing focus rects in the foreground. high repaint performance mostly
requires using windows API calls where you calculate the regions that
need repainting and limit the burden.

T.

Re:Free components/units to deal with PNG format


Hi Petr,

besides using DLL's as Tunc suggested, you could also store your images in
(for example) Paradox blob fields and retrieve them as needed.

HTH
Uwe

Petr Selinger <selin...@sl.inext.cz> schrieb in im Newsbeitrag:
7r3c6n$t...@forums.borland.com...

Quote
> Hi all,
> Could anyone advise me a method for storing an Images for my application?

> I don`t want to use Resource files, because they`re linked to exe file and
> it takes more space - my app is about 14Mb now

> I`m loading them from disk now, but anybody can simply edit them. I tried
to
> load them from Stream, but it doesn`t work (see my other mail). I need
also
> fast redrawing, because the Images are used like a background of a form
and
> it doesn`t look good if you must wait for them.

> Can anyone help me, please?

> Thanx,
>                      Petr Selinger, selin...@sl.inext.cz

Re:Free components/units to deal with PNG format


Quote
Petr Selinger <selin...@sl.inext.cz> wrote in message

news:7qtffa$mii13@forums.borland.com...

Quote
> Hi all,
> I have a problem with loading Images from Stream.
> Image after loading from Stream is present, but not visible, even if the
> property Visible is true and Parent is Self. I tried to call Invalidate
and
> Update for this Image but with no effect.

> Code:
>   ...
>   { Create stream object in read-only mode }
>   Stream := TFileStream.Create(fileName, fmOpenRead);
>   try
>     Image1 := TImage(Stream.ReadComponent(nil));  { Read & Create B }
>     Image1.Parent := Self;                        { Assign parent }
>     Image1.Visible:=true;                          { Visibility }
>     // Image1.Invalidate;                             { It has no effect
> -( }
>     // Image1.UpDate;
>   finally
>     Stream.Free;  { Destroy the file stream object }
>   end;
>   ...

> Can anyone help me, please?

> Thanx,
>                      Petr Selinger, selin...@sl.inext.cz

Petr,

  It is unusual to ever write a component by itself to a stream, or read a
component from a stream.  If you're wanting to write the image data
displayed by a TImage control to a stream, write the data, not the control:

  Image1.Picture.SaveToStream(Stream)

Image1.Picture.SaveToStream will write the file extension or class name (I
forget which) before writing the image data, so that TPicture will know what
kind of graphic class to create when you later call
Image1.Picture.LoadFromStream.  This is the easiest route to take.

You would then load the image data from the stream into an existing image
control like this:

Image1.Picture.LoadFromStream(Stream);

Since your sample code is reading directly from a disk file, I'm wondering
if you're intending to load something like a BMP file into the image
control.  If so, don't do it this way.  Just call
Image1.Picture.LoadFromFile(filename) and it will figure out from the file
extension what kind of graphic class to instantiate to load the actual image
 data from the file.

-Danny Thorpe

--
Delphi created here:
http://albums.photopoint.com/j/AlbumIndex?u=57458&a=435308

Other Threads