Solved

Saving jpeg as bitmap

Posted on 1999-01-13
15
540 Views
Last Modified: 2013-11-19
How do i save a bitmap as a jpeg, using a TImage.
0
Comment
Question by:WarheaD
  • 6
  • 5
  • 3
  • +1
15 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 1356272
hi
try this:
image1.picture.savetofile('c:\bmpasjpg.jpg');

Regards Barry
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356273
Barry: That is correct but Warhead will need to add teh jpeg unit from the D4 CD (in the info\Extras\jpeg directory on the CD)

Cheers,

Raymond.
0
 
LVL 17

Expert Comment

by:inthe
ID: 1356274
hi
Raymond i just did this in d4(no jpg components) and it worked fine how come you have to add jpg unit ?
Regards Barry
0
 

Author Comment

by:WarheaD
ID: 1356275
hi

i've already got the jpeg stuff in my delphi, but i dont have delphi on this machine so i'll get back later.

thanx
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356276
Barry: The jpeg code is not included in the TImage components by default (its pretty chunky and adds some 150k to your app). Try loading the .JPG files into TImage and see what happens.

Did it produce a JPEG file, or a BMP file with a JPG extension?

Raymond.
0
 
LVL 17

Expert Comment

by:inthe
ID: 1356277
Sorry raymond you right without jpg it produce bmp with jpg extension
Regards Barry
0
 

Author Comment

by:WarheaD
ID: 1356278
I'm back (a week later)

I have included the jpeg.dcu into my uses, but i still get a bitmap with jpeg extension.
When I do it the other way round( i.e jpeg to bitmap), i get a jpeg with bitmap extension.


0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:WarheaD
ID: 1356279
I'm back (a week later)

I have included the jpeg.dcu into my uses, but i still get a bitmap with jpeg extension.
When I do it the other way round( i.e jpeg to bitmap), i get a jpeg with bitmap extension.


0
 
LVL 17

Expert Comment

by:inthe
ID: 1356280
first your question was :
How do i save a bitmap as a jpeg, using a TImage.well that question is answered,what you want to do is convert a jpg to a bitmap which is different,below is a link to efg's source for doing this.it is source for bmp to jpg(visa versa) for commandline ,but you should be able to see whats happening
Happy coding
Regards Barry

http://www.efg2.com/lab/library/delphi/graphics/BMPtoJPG.PAS.txt
0
 
LVL 17

Expert Comment

by:inthe
ID: 1356281
also go here:
http://www.efg2.com/lab/Graphics/BMPJPG.htm

and download bmpjpg.zip,has full sources inside for doing conversions
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356282
Well, here is the missing bit I think...

You can make another TImage then just assign the graphic to the bitmap to convert the graphic to the bitmap (the graphic property will contain the JPEG image you loaded into it). Like this:

  image2.picture.bitmap.assign(Image1.picture.graphic);

However, if you want to go both ways this is perhaps not a suitable solution...

Cheers,

Raymond.
 
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1356283
Hi All,
Interesting, browsing through these back end questions, I'm currently working on a Word doc to JPEG converter, and I see some input here, I had already all the pieces working only with quite some overhead.

:O)Always happY.
0
 

Author Comment

by:WarheaD
ID: 1356284
Hey inthe

The conversion doesn't work either way, but thanks for the links. I'll give you the points anyway, because everyone here says it should work too. So just answer again so i can give them to you.
0
 
LVL 17

Accepted Solution

by:
inthe earned 30 total points
ID: 1356285
hi there warhead
ok then i'll answer but what do you mean the conversion dosent work either way?
did you download bmpjpg.zip ?
it contains both sources and executables to convert from one to the other. jpgtobmp.exe and bmptojpg.exe
Regards Barry
0
 

Author Comment

by:WarheaD
ID: 1356286
hi inthe

Although the answer wasn't correct, i've assigned the ponts to you.

Cheers

P.S BoRiS E-mailed me the correct answer!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this Micro Tutorial viewers will learn the basic shortcuts and functions in InDesign.
Add visuals to your Prezi to keep your audience engaged. Learn how to embed images, edit them, and more in this video micro tutorial. Select "Insert" from the top menu in your Prezi editor: Select "Image": A toolbar will pop in from the right …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now