Archived

This topic is now archived and is closed to further replies.

a library to modify bitmaps

This topic is 5581 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am programming in Delphi6 and I want to make a program that can modify pictures automatically (I don''t need to view the pictures on the screen). The main modification I want to make is pasting a piece of a bitmap in another bitmap and save it to a different file. So I may also need to change the scale, to rotate, to adjust luminosity and contrasts etc.. Could someone help me and tell me what should I use to handle this properly ? or just give some links ? Thank you for your help.

Share this post


Link to post
Share on other sites
Thank you for this link, ImageMagik seems to be a very useful tool for programming in C++, Perl, Java ... But not for Delphi, unfortunately. So my question remains the same : How to modify pictures in Delphi6 ?

Share this post


Link to post
Share on other sites
You can copy sub-images from one canvas to another using the relevant canvas''s CopyRect method, then use yourBmp.SaveToFile(''somefile.bmp'');

You can use StretchDraw to scale your bitmap if you want (again, a member of TCanvas which means it''s available for your bitmap). I''ve also got an example of quickly scaling a bitmap down; that doesn''t care about quality, though, and doesn''t scale up past the original size.

For everything else, you must check out Earl F. Glynn''s site right now: http://www.efg2.com/Lab/index.html. It contains absolutely *everything* you need.

Share this post


Link to post
Share on other sites
Thank you for your help, Alimonster, because I am really a newbie in plrogramming in Delphi. I think both your link and the methods you gave me will be useful. By the way I have another question : what would you use to do the same with *.tga picture files ? (I am not sure that TGraphic or TPicture are able to handle this kind of files)
Again, thank you for your help.

Share this post


Link to post
Share on other sites
You might want to take a look at Mike Lischke's GraphicsEx library. This contains a bucket-load of extra formats. Unfortunately, I don't think that all of the formats there can be saved (though it's probably possible to assign them to a bitmap and save that), but you can't win every time. I'm pretty sure that there are other libraries out there to load TGAs in Delphi (maybe Sulaco has one, I'd guess) but I don't know off-hand.

If you want .JPG support then you simply have to add "jpeg" to the uses clause, which is a standard Delphi thing. Be aware that you'd have to assign to a bitmap first if you wanted to modify it (I think), in which case you might want to take a look at TJPEGImage.DIBNeeded. Also, there's a compressquality (?) setting that lets you modify the compression before using .SaveToFile.

EDIT: sorted HTML for link

EDIT 2: Spotted this - looks like you're in luck for the TGA saving...

quote:
Currently only TTargaGraphic supports also storing an image, but [...]


[edited by - Alimonster on August 30, 2002 5:10:16 PM]

Share this post


Link to post
Share on other sites