Solved

Saving jpeg as bitmap

Posted on 1999-01-13
15
547 Views
Last Modified: 2013-11-19
How do i save a bitmap as a jpeg, using a TImage.
0
Comment
Question by:WarheaD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AutoCad licenses 9 87
how can i search if string exist in array ? 3 69
update joined tables 2 62
How to Get Images From Server to Client using App Tethering 1 40
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Not only does Prezi allow you to create non-linear presentations, it also makes it easy to apply transition animations between your frames. Learn how to apply a fade-in transition to select items and entire frames in this tutorial Select "Edit Path"…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

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