Solved

JPEG Images

Posted on 1998-12-11
16
448 Views
Last Modified: 2013-11-19
I think this may be a little known fact...but hidden on the Delphi 3 CD ROM is a folder called INFO.  Inside of the INFO folder is another folder called EXTRAS.  Inside of EXTRAS is a folder called JPEG.

The JPEG folder is pretty cool.  It has files you can install that allow you to use a TImage component to view JPEG images.  JPEG images have a compression algorithm which allows them to take up a lot less space than an equivalent .BMP image.

I installed JPEG support into my copy of Delphi 3...and sure enough...now I can view JPEGS in Delphi 3.  I was pretty excited.

But now, I can't utilize any of the other methods that make TImage so cool.  For example...when I try to draw a Focus Rect on the JPEG image...the program crashes / give me an error message:

EInvalidOperation:  Can only modify an image if it contains a bitmap

Can someone help me figure out what to do?  It seems silly to allow TImage to load JPEG images...but then you can't do anything with them.

If I load a bitmap instead of a JPEG...I can use all of the methods of  TImage with no problems.

Thanks.
0
Comment
Question by:Tom Knowlton
[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
  • 9
  • 5
  • 2
16 Comments
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1350622
Edited text of question
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1350623
Edited text of question
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1350624
Hi

My understanding of Delphi's JPegs is that they don't have a published canvas to work with.  I have overcome this problem before by using "dummy" bitmaps as follows:

Bmp := TBitmap.Create;
Bmp.Assign(MyJPeg);
// Do stuff with the Bmp...
MyJPeg.Assign(Bmp);
Bmp.Free;

A bit clumsy, but it works.

Cheers,
JB
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!

 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1350625
Edited text of question
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1350626
JimBob is right...

btw- KnowIton, what's up with your Sprites Editror (or was it Game Editor)?? Anyway, did you get it done??

Cheers,
Viktor
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1350627
JimBob:

I will be giving you your points here shortly...as soon as I have a chance to try it out and get it working.  Sounds like you know what you'r talking about.

Viktornet:

Hey, my friend!  Good to hear from you!  The Gargor Map Editor is ON HOLD for the moment.  I haven't done anything with it for 3 or 4 months now.  I still have all the source code for it and have every intention of working on it again some day...but don't hold your breath.

BUT, I do have another project I'm working on which is a MYST type game.  There is another person helping me with it (a co-worker, actually).  He is doing all of the art in POV-Ray and it looks really nice.  He's also able to make some fine-looking AVI movies as well so we'll have some nice intros and cut scenes.  If you want to help with the project just let me know.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1350628
JimBob:

Go ahead and resubmit your comment as an answer. Thanks for your help.

Tom
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1350629
Hello Tom!

NIce to hear from also :)

I haven't had much time to work with Delphi lately, but if oyu need specific help, I might try and help you. I'd also really like to see what you've done so far... What actually is the MYST kinda game??? I have no idea what that is.. 10Q

Cheers,
Viktor
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 30 total points
ID: 1350630
Hi knowlton, glad to be of help.
Cheers,
Dave

0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1350631
JimBob:

Here are your points.  

BUT:  It's not working correctly.  There is some subtlety of this process I'm haven't figured out.

The JPEG is being assigned to a TImage component I have already dropped on the form.  But the TBitmap is being created from scratch.  And...how do I draw on the TBitmap?  I can assign the JPEG image to the TBitmap...just like you said....but I can't do anything with the TBitmap.

Please help me.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1350632
Viktornet:

MYST is a point-and-click type game which concentrates more on visually stunning still pictures and puzzles.  There is this immense 3D world you can fully explore.  Pretty cool.  

JimBob is not getting back to me yet.  Can you provide any help with TBitmap and TImage?
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1350633
Hi knowlton

Sorry about the delay - I don't have 24-hr online internet access!!  ;-)

You can draw on a bitmap's canvas:
  MyBmp.Canvas.MoveTo(0, 0);
  MyBmp.Canvas.LineTo(100, 100);
  etc...

Then assign it back to the JPEG.

Does this help you?

Dave
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1350634
I will try this as soon as I can.

Does the bitmap get assigned to a TImage as well?
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1350635
From what I recall (I'm not at my Delphi PC) you assign the bmp to TImage.Picture:

MyImg.Picture.Assign(MyBmp);

Cheers,
Dave

0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1350636
The IS working now.  Thanks so much.
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1350637
No prob.
 -Dave
0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

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…
Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Learn how to create interesting presentations by including videos to keep your audience engaged using Prezi. Select "Insert" from the top menu in your Prezi editor: Select "YouTube Video": Paste the video URL into the prompt: "Select "Insert":…

739 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