Board index » delphi » JPEG -> BMP conversion in Delphi

JPEG -> BMP conversion in Delphi

Has anyone managed to write some Delphi code to do the following?  I would
really appreciate some help!

What I am doing is creating a Device Context and building a large bitmap on it
before blitting it onto the screen.  The large picture is a combination of
smaller pictures, stored in JPEG files.  What I need is code to load a JPEG
from disk and return a handle to a bitmap that I can blit onto the device
context.  It is just not possible for me to store the pictures as bitmaps as
there are about 100MB of them, and stored as JPEGs it's just over 15MB.

Also, is there any way I can store a JPEG in a resource file and load it at
run-time?  This is the one shortcoming I have with JPEGs, and that's that I am
going to have to ship around 1400 jpeg files unless I can get them into
resource files!

Any help would be greatly appreciated
Thanks
Dennis

PS  Could replies by made by personal email, if at all possible?

 

Re:JPEG -> BMP conversion in Delphi


JPEGS to Bitmaps should be a FAQ! Either that or I should write a
component, sell it for $10 and make my first million!

Quote
> Also, is there any way I can store a JPEG in a resource file and load it
at
> run-time?  This is the one shortcoming I have with JPEGs, and that's
that I am
> going to have to ship around 1400 jpeg files unless I can get them into
> resource files!

You could use TCompress to store all the jpegs into a single file,
extracting them as needed. Find out more by visiting www.spis.co.nz.

Regards,

Rafe

Re:JPEG -> BMP conversion in Delphi


hello,
A fantastic site for vbx, dlls, ocx, delphi component, powerbuilder
object, ect. for viewing various graphics, including super fast jpeg and
palette control is:
http://www.imagn.com/   There is a demo there as well and the
professional version component is $395 (US).
regards,
jack

PS - one option is to get a handle to a dib, at 8, 16 or 24 bit color
depth.  Good luck.

Quote
Dennis Battiscombe wrote:

> Has anyone managed to write some Delphi code to do the following?  I would
> really appreciate some help!

> What I am doing is creating a Device Context and building a large bitmap on it
> before blitting it onto the screen.  The large picture is a combination of
> smaller pictures, stored in JPEG files.  What I need is code to load a JPEG
> from disk and return a handle to a bitmap that I can blit onto the device
> context.  It is just not possible for me to store the pictures as bitmaps as
> there are about 100MB of them, and stored as JPEGs it's just over 15MB.

> Also, is there any way I can store a JPEG in a resource file and load it at
> run-time?  This is the one shortcoming I have with JPEGs, and that's that I am
> going to have to ship around 1400 jpeg files unless I can get them into
> resource files!

> Any help would be greatly appreciated
> Thanks
> Dennis

> PS  Could replies by made by personal email, if at all possible?

--
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jack Berlin         Pegasus Imaging Corporation
           the BETTER JPEG people!
    813-875-7575 x303    Fax 813-875-7705
               http://www.jpg.com
***************************************************

Re:JPEG -> BMP conversion in Delphi


Quote
In article <532lic$...@hermes.is.co.za>, dbatt...@investec.co.za (Dennis Battiscombe) wrote:

>Has anyone managed to write some Delphi code to do the following?  I would
>really appreciate some help!

>What I am doing is creating a Device Context and building a large bitmap on it
>before blitting it onto the screen.  The large picture is a combination of
>smaller pictures, stored in JPEG files.  What I need is code to load a JPEG
>from disk and return a handle to a bitmap that I can blit onto the device
>context.  It is just not possible for me to store the pictures as bitmaps as
>there are about 100MB of them, and stored as JPEGs it's just over 15MB.

>Also, is there any way I can store a JPEG in a resource file and load it at
>run-time?  This is the one shortcoming I have with JPEGs, and that's that I am
>going to have to ship around 1400 jpeg files unless I can get them into
>resource files!

>Any help would be greatly appreciated
>Thanks
>Dennis

Have a look at the tools from Meister. I do not know the URL

Happy Hacking The Graphical Gnome

----------------------------------------------
| Rob den Braasem    | Voice :-31-79-3531520 |
|                    | Fax   :-31-79-3513561 |
|                    | Mail  : r...@ktibv.nl  |
|                    |-----------------------+---------------------+
| KTI bv             | "I die when it's time for me to die.        |
| P.O. Box 86        | So let me live  my life the way I want to." |
| 2700 AB Zoetermeer |                                             |
| The Netherlands    |   Jimi Hendrix                              |
-------------------------------------------------------------------+

Re:JPEG -> BMP conversion in Delphi


Quote
In article <01bbb214.c2f7a440$0565a8c0@rafe> r...@oxfordcc.co.uk writes:
>> Also, is there any way I can store a JPEG in a resource file and load it
>at >> run-time?  This is the one shortcoming I have with JPEGs, and that's
>that I am
>> going to have to ship around 1400 jpeg files unless I can get them into
>> resource files!
>You could use TCompress to store all the jpegs into a single file,
>extracting them as needed. Find out more by visiting www.spis.co.nz.

Well, no, TCompress would not be ideal for handling JPEGs, because they are
already highly compressed. You could conveniently use it if you had
*already* expanded each image to a bitmap and wanted to store the latter
compressed in a resource file.

However, some clues for you:
a) TCompress 2.5 has some sample projects showing how to get binary
resources into a resource file -- i.e. the general approach would be of
interest to get you going

b) The code below is a general routine to get a stream handle to a resource
from a program (or DLL) using Delphi 2.0's convenient TResourceStream -- in
Delphi 1 it is a *little* harder, but not heaps.

function LoadMyResource(ResourceName, DLLName: string): TStream;
var  hFileInstance :  THandle;
begin
  result := nil;
  if DLLName<>'' then
  begin
    hFileInstance := LoadLibrary(PChar(DLLName));   { Load DLL }
    if hFileInstance=NULL then { oops }
       raise(Exception.create('Could not load '+DLLName+' DLL'));
  end else
    hFileInstance := HInstance; { the handle to the current EXE }
  try
    result :=
TResourceStream.Create(hFileInstance,ResourceName,PChar('YOUR_RESOURCE_TYPE'));
  finally
    if DLLName<>'' then { must free Library }
       FreeLibrary(hFileInstance );     { Always Unload DLL }
  end;
end;

Hope this helps.

cheers,
peter

--
====================================================================
Peter Hyde, South Pacific Information Services Ltd, Christchurch, NZ
* SPIS Webview 2.5 Offline Browser and WebWatch 1.01 Site Monitor
* "Climbing Out on the Web" web site primer
* TCompress 2.5 File and Database Compression for Delphi
Find all the above and MORE at http://www.spis.co.nz/

Other Threads