Converting a bitmap to a jpg

Converting a bitmap to a jpg

Post by Lord C » Tue, 23 May 2000 04:00:00




>how can i convert a bitmap to a jpg and vice versa by sourcecode
>regards Hermann

look up on TJPEGImage in the help file (d3+ i belive)

the clue is to use .Assign()

- Asbj?rn

 
 
 

Converting a bitmap to a jpg

Post by Earl F. Glyn » Tue, 23 May 2000 04:00:00



> how can i convert a bitmap to a jpg and vice versa by sourcecode
> regards Hermann

Look at either of these pages for an example or links:
http://www.efg2.com/Lab/Graphics/BMPJPG.htm
http://www.efg2.com/Lab/Library/Delphi/Graphics/FileFormatsAndConvers...

--
efg


Overland Park, KS  USA

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

 
 
 

1. Resizing a bitmap and converting to a jpg

I am trying to re-size a bitmap and then save it as a jpg.  I load it in a
Timage allow it to be resize in the Timage then use that size to re-size it.

The code below works to convert it to a jpg but the picture is not resized
only cropped. In the Timage the bmp appears to be sized right but I lose
that in the save.
Can someone point out where I am going wrong ?
Any suggestions appreciated.

Larry

     Bitmap.LoadFromFile(Form1.OpenPictureDialog1.FileName);
     Jpeg.PixelFormat   := jf24bit;
     Bitmap.Width       := form1.Image1.Width;  { set width }
     Bitmap.Height      := form1.Image1.Height; { set height }
     //  resize here

      Bitmap.canvas.stretchdraw(rect(0,0,form1.image1.width,
       form.image1.height),bitmap);

      Bitmap1.assign(Bitmap);
      Jpeg.CompressionQuality := 80;
      Jpeg.Assign(Bitmap1);

      L := Length(PicType);
      PicName := copy(PicName,1,Length(picName)-L);
      PicName := Lowercase(PicName) + '.jpg';
      Jpeg.SaveToFile(PicName);

2. OpenGL, seen with 3D glasses

3. Converting bitmap to jpg

4. Kia Power tools

5. Convert many .jpg to 1 big .jpg filmstrip

6. Light from within object

7. Converting pict.jpg to jfif.jpg

8. Converting MIME.JPG to PS.JPG

9. How to convert many .jpg files to 1 large .jpg (filmstrip)

10. mogrify : convert image a.jpg to a_new.jpg

11. Convert and resize BMP,JPG,Tif in JPG

12. converting images in Portbal Bitmap to Bitmap