开发者

Extracting the "n"th image out of a bmp (or other image type)

I have a bmp image that's co开发者_Python百科mprised of 13 images, and each image is exactly 17x17. Aside from breaking this image down through gimp into 13 different images, what is a good way to 'extract' the nth image from this list (into a char array, preferably) so that I may then use it? I've tried advancing the pointer forward by n*17*17 pixels, and aside from the fact that it ignores the header, thought this should work - unfortunately, it doesn't.

Suggestions?

Note that I've tagged this as C and C++ because I'm happy to see/hear of a solution in either language.


Perhaps use existing tools for tile cropping

convert paged.gif  +gravity -crop 32x32  tiles_%d.gif

Imagemagick comes with an API that is usable from many language, including C, C++, php, perl, etc etc The relevant function would seem to be

CropImageToTiles

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜