Board index » delphi » BMP -> JPEG (delphi 3)

BMP -> JPEG (delphi 3)

Hello !

        I would like to convert a BMP image to a JPEG image with DELPHI
3.
        How to use TJPEGImage ?

        Thanks...

--
+------------------------------------------+
|  SARL INFOCOB 71, av Joseph CHAILLEY     |
|  B.P. 76 - 85102 LES SABLES D'OLONNE     |
|  Tl: 02.51.21.64.64 Fax:02.51.21.63.96  |
|  http://wwwperso.hol.fr/~infocob         |
|       E-mail:info...@hol.fr              |  
+------------------------------------------+

 

Re:BMP -> JPEG (delphi 3)


Quote
infocob wrote:
>         I would like to convert a BMP image to a JPEG image with
> DELPHI
> 3.
>         How to use TJPEGImage ?

Create a TJPEGImage, a TBitmap, load the bitmap, then Assign it to the
JPEG. I think that's what you need to do.

Pete

Re:BMP -> JPEG (delphi 3)


Quote
Martin Brooks wrote:

> Pete Goodwin wrote:

> > infocob wrote:

> > >         I would like to convert a BMP image to a JPEG image with
> > > DELPHI
> > > 3.
> > >         How to use TJPEGImage ?

> > Create a TJPEGImage, a TBitmap, load the bitmap, then Assign it to the
> > JPEG. I think that's what you need to do.

> In my humble opinion the TJPEG component is a waste of diskspace. Use
> NView freeware component available from the Delphi Super Page.

        Well, I'm certain the NView thing is just great. But what's
your complaint with TJPEGimage, exactly?

--
David Ullrich

sig.txt not found

Re:BMP -> JPEG (delphi 3)


Quote
Martin Brooks wrote:
> In my humble opinion the TJPEG component is a waste of diskspace. Use
> NView freeware component available from the Delphi Super Page.

  What makes you say that? I've used the TJPEG component with little
difficulty and it's been very useful to me. Why should I use NViewLib
and add 259KB to my installation package, when I can easily use the jpeg
component, adding only a little bit more to my EXE's size?

  Of course, the real reason you use NViewLib is because it can handle a
decent number of image formats, including gif, bmp, pcx, tga, dib, rle.
But if I want jpeg only, I use the jpeg component. My $0.02.

Re:BMP -> JPEG (delphi 3)


i tried the NviewSaveas(80,'file.jpg) ; and it dont work
even tried reloading the created bmp and then saving still no luck?

any hints?

Quote

>> >         I would like to convert a BMP image to a JPEG image with
>> > DELPHI
>> > 3.
>> >         How to use TJPEGImage ?

>> Create a TJPEGImage, a TBitmap, load the bitmap, then Assign it to the
>> JPEG. I think that's what you need to do.

>In my humble opinion the TJPEG component is a waste of diskspace. Use
>NView freeware component available from the Delphi Super Page.

>--

>Martin Brooks - Systems Administrator
>=====================================
>Image Data Systems (UK) Ltd
>82-84 Clerkenwell Road
>London
>EC1M 5RJ

>  T: 0171 336 7942
>  F: 0171 336 7943
>  E: mar...@image-data.com
>UIN: 2178117

>- Computers make very fast, very accurate mistaks -

>--------------F27777988F7837EFEA3CD6AF
>Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
>Content-Transfer-Encoding: 7bit
>Content-Description: Card for Martin  Brooks
>Content-Disposition: attachment; filename="vcard.vcf"

>begin:          vcard
>fn:             Martin  Brooks
>n:              Brooks;Martin
>org:            Image Data Systems (UK) Ltd
>adr:            82-84 Clerkenwell Road;;;London;;EC1M 5RJ;UK
>email;internet: mar...@image-data.com
>title:          Systems Administrator
>tel;work:       +44 (0) 171 336 7942
>tel;fax:        +44 (0) 171 336 7943
>x-mozilla-cpt:  ;0
>x-mozilla-html: FALSE
>version:        2.1
>end:            vcard

>--------------F27777988F7837EFEA3CD6AF--

Re:BMP -> JPEG (delphi 3)


This is a multi-part message in MIME format.
--------------9BC491DD8B1CDD7D7F14DD53
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Quote
hdashti wrote:
> i tried the NviewSaveas(80,'file.jpg) ; and it dont work
> even tried reloading the created bmp and then saving still no luck?

> any hints?

I found an interesting problem that isn't specifically noted on the Delphi
reference. Not really a bug, more of an annoyance. When you use
TBitMap.Create to create your internal bitmap your *must* specify the pixel
format otherwise you end up with a corrupt bitmap that NView won't touch.

So, hopefully adding  TBitMap.PixelFormat:=pf24bit  will sort out the
problem. It took me about a week to track this one down.

--

Martin Brooks - Systems Administrator
=====================================
Image Data Systems (UK) Ltd
82-84 Clerkenwell Road
London
EC1M 5RJ

  T: 0171 336 7942
  F: 0171 336 7943
  E: mar...@image-data.com
UIN: 2178117

- Computers make very fast, very accurate mistaks -

--------------9BC491DD8B1CDD7D7F14DD53
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Martin  Brooks
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Martin  Brooks
n:              Brooks;Martin
org:            Image Data Systems (UK) Ltd
adr:            82-84 Clerkenwell Road;;;London;;EC1M 5RJ;UK
email;internet: mar...@image-data.com
title:          Systems Administrator
tel;work:       +44 (0) 171 336 7942
tel;fax:        +44 (0) 171 336 7943
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard

--------------9BC491DD8B1CDD7D7F14DD53--

Re:BMP -> JPEG (delphi 3)


Quote
Martin Brooks wrote:

> hdashti wrote:

> > i tried the NviewSaveas(80,'file.jpg) ; and it dont work
> > even tried reloading the created bmp and then saving still no luck?

> > any hints?

> I found an interesting problem that isn't specifically noted on the Delphi
> reference. Not really a bug, more of an annoyance. When you use
> TBitMap.Create to create your internal bitmap your *must* specify the pixel
> format otherwise you end up with a corrupt bitmap that NView won't touch.

> So, hopefully adding  TBitMap.PixelFormat:=pf24bit  will sort out the
> problem. It took me about a week to track this one down.

        The point is that suddenly a TBitmap can be either a DDB or a
DIB. Setting the value of PixelFormat changes it from a DDB to a DIB -
presumably this NView thing is expecting a DIB:

var b: TBitmap;
begin
 b:= TBitmap.Create;
 if b.HandleType = bmDIB then
    showmessage('DIB')
   else
    showmessage('DDB');

 b.PixelFormat:= pf24Bit;

 if b.HandleType = bmDIB then
    showmessage('DIB')
   else
    showmessage('DDB');

 b.Free;
end;

--
David Ullrich

sig.txt not found

Other Threads