Convert BMP to JPEG and JPEG to BMP

Convert BMP to JPEG and JPEG to BMP

Post by Mário Guimar?es Buratt » Wed, 11 Aug 1999 04:00:00



How can i convert a JPEG to bitmap and bitmap to JPEG?
Thanks,
Mario
 
 
 

Convert BMP to JPEG and JPEG to BMP

Post by Team » Wed, 11 Aug 1999 04:00:00


Just assign one to the other like

  j->Assign(b);

where j is your TJPEGImage and b is your TBitmap.  The reverse will copy a JPEG
into a Bitmap.


> How can i convert a JPEG to bitmap and bitmap to JPEG?
> Thanks,
> Mario

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
The mist crawls from the c*like some primordial phantom of romance
To curl, under the cascade of neon pollen.  While I sit tied to the phone
like some expectant father, your carnation will rot in a vase.
             (Fish)
--

 
 
 

Convert BMP to JPEG and JPEG to BMP

Post by Mário Guimar?es Buratt » Fri, 13 Aug 1999 04:00:00


I can't convert. when i try to convert i got a error message:
'Cannot assign  a TPicture to a TBitmap'



> Just assign one to the other like

>   j->Assign(b);

> where j is your TJPEGImage and b is your TBitmap.  The reverse will copy a
JPEG
> into a Bitmap.


> > How can i convert a JPEG to bitmap and bitmap to JPEG?
> > Thanks,
> > Mario

> --
> Jeff Overcash (TeamB)
>       (Please do not email me directly unless  asked. Thank You)
> The mist crawls from the c*like some primordial phantom of romance
> To curl, under the cascade of neon pollen.  While I sit tied to the phone
> like some expectant father, your carnation will rot in a vase.
>              (Fish)
> --

 
 
 

Convert BMP to JPEG and JPEG to BMP

Post by Jonathan Arnol » Sat, 14 Aug 1999 04:00:00


Quote:> I can't convert. when i try to convert i got a error message:
> 'Cannot assign  a TPicture to a TBitmap'

Not a TPicture. A TPicture is a higher level abstraction and can contain
a bitmap, icon, metafile, whatever. Use the Bitmap or Graphic property
of it.

+===================================================+

| http://www.buddydog.org                           |
+===================================================+

We have enough youth. How about a fountain of Smart?
 - Anonymous

 
 
 

1. Strange different behaviour between .BMP and jpeg-converted .BMP

Trying to use a function which is able to convert a TBitmap to another
TBitmap, I got a different behaviour between the following to cases:

1) using a .bmp-file directly created from a standard graphics program
2) using a .jpg-file also directly created from a standard graphics
program. This one I tried to convert inside BCB to a .bmp file and use
it with the same function (see code-snippet below)

Result:
  tst0.bmp look quite similar in both cases 1) und 2)
  tst1.bmp look quite different. The resulting picture's  right margin
seems to have been cutted and it seems to have been stretched,

 if(ExtractFileExt(article_filename)==".bmp") {
    src_bitmap->LoadFromFile(article_filename);
  }
  else if(ExtractFileExt(article_filename)==".jpg")  {
    TJPEGImage *src_jpg_image=new TJPEGImage;
    src_jpg_image->LoadFromFile(article_filename);
    src_bitmap->Width=src_jpg_image->Width;
    src_bitmap->Height=src_jpg_image->Height;
    src_bitmap->Canvas->Draw(0, 0, src_jpg_image);
    TPicture *picture=new TPicture;
    picture->Assign(src_bitmap);

    TMemoryStream *mem_stream=new TMemoryStream();
    picture->Bitmap->SaveToStream(mem_stream);
    mem_stream->Position=0;
    src_bitmap->LoadFromStream(mem_stream);
    delete mem_stream;
  }
  else
    return;

  Graphics::TBitmap *dst_bitmap=new Graphics::TBitmap;

  MY_FUNC(dst_bitmap, src_bitmap);

  src_bitmap->SaveToFile("c:\\tst0.bmp");
  dst_bitmap->SaveToFile("c:\\tst1.bmp");

So my question: Is in the conversion in the .jpg-case an obvious
error, so the resulting .bmp-file is a problematic one?

Perhaps there is even a much more easier way to convert a jpeg-file's
bitmap in a .bmp-bitmap. I tried it another way, but MY_FUNC()
contains ScanLine(), which seems to last a half eternity to be
executed for each line of a comperssed picture (, so I decided to
convert it into a uncompressed bitmap for fast processing...)

Thanks a lot,

Michael

2. Graphics Packages for User Interface Development

3. graphics images (BMP or JPEG) to BMP

4. How to include Mesalib file in a project using Kdevelop?

5. Converte BMP to JPEG and store JPEG in a MYSQL DB

6. PICT files

7. 24bit Jpeg to 8bit Jpeg (or bmp)

8. Algorithmic Sculpting?

9. Convert JPEG to BMP?

10. convert JPEG files to TGA or BMP or PCX or TIF format

11. convert BMP tp JPEG

12. Converting Bitcom .bfx files to jpeg or gif or bmp files

13. Converting PC-Paint files to Bmp or Jpeg.