Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Batch processing images using U++ (new Image code)
Batch processing images using U++ (new Image code) [message #2750] |
Mon, 24 April 2006 12:00 |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Well, before I delete that code, I recently had a problem (while working on some www page): a couple of .bmp images had to be normalized to single size, horizontally center bottom aligned and added 2 pixels border and saved as 4 bpp PNG. Sure, one could use photoshop and do it image by image (and frankly perhaps there are some sofisticated tools that can do this), but one can also use U++:
FindFile ff("e:\\h\\*.bmp");
while(ff) {
Image m = StreamRaster::LoadFileAny(AppendFileName("e:\\h", ff.GetName()));
ImageDraw iw(64, 64);
iw.DrawRect(0, 0, 64, 64, Color(255, 218, 91));
DrawFatFrame(iw, 0, 0, 64, 64, Black, 2);
iw.DrawImage((64 - m.GetWidth()) / 2, 62 - m.GetHeight(), m);
PNGEncoder png(4);
png.SaveFile(AppendFileName("d:\\images", ForceExt(ff.GetName(), ".png")), iw);
ff.Next();
}
|
|
|
Goto Forum:
Current Time: Fri Apr 25 13:09:44 CEST 2025
Total time taken to generate the page: 0.02464 seconds
|