Solved

Saving jpeg as bitmap

Posted on 1999-01-13
15
539 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Learn the basics of inputting and editing your text components in Prezi. We will cover how to set styles, position, and group your text components. In your Prezi editor, click anywhere on the canvas to add text: A flashing cursor informs you that yo…
In addition to being a great web-based presentation tool, Prezi also makes it easy to save your presentation as a PDF to share with others as well. Learn how in this tutorial. Select the share icon from the top menu in your Prezi editor: Select "D…

762 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

17 Experts available now in Live!

Get 1:1 Help Now