Image Stride
Image Stride
I'm using the latest IM and the Magick++ interface. I need to provide an image's stride, along with the image width, to a function in a 3rd party library. However, I don't see how to retrieve/calculate an image's stride via the API. Any hints on how I can determine this info? I checked the docs and Google, but was unable to find a solution. Thanks!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Image Stride
tc33 wrote:I'm using the latest IM and the Magick++ interface. I need to provide an image's stride, along with the image width, to a function in a 3rd party library. However, I don't see how to retrieve/calculate an image's stride via the API. Any hints on how I can determine this info? I checked the docs and Google, but was unable to find a solution. Thanks!
I know nothing about Magick++, but in reviewing the documentation, I see that info is at Accessing Image Attributes at http://www.imagemagick.org/Magick++/tut ... torial.pdf. See link to Gentle Introduction at http://www.imagemagick.org/script/magick++.php
Re: Image Stride
Thanks. I re-reviewed the documentation, but was unable to determine which attribute is the 'stride'. What is the name of the stride attribute?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Image Stride
I expect you mean heighttc33 wrote:Thanks. I re-reviewed the documentation, but was unable to determine which attribute is the 'stride'. What is the name of the stride attribute?
width is the horizontal number of pixels and height is the vertical number of pixels in an image.
Re: Image Stride
Stride is different than height or width; I'm looking for the stride (or pitch?)
http://msdn.microsoft.com/en-us/library ... 73780.aspx
Right now i'm just using stride = columns * channel count, but don't know how to account for any other padding that may exist. I'm using the BMP2 format for this operation, so additional row padding might not even be in the spec; I'll have to dig a bit deeper to be sure. Thanks
http://msdn.microsoft.com/en-us/library ... 73780.aspx
Right now i'm just using stride = columns * channel count, but don't know how to account for any other padding that may exist. I'm using the BMP2 format for this operation, so additional row padding might not even be in the spec; I'll have to dig a bit deeper to be sure. Thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Image Stride
Sorry, I have never seen anything like that in IM. Is that for some special Windows video format? IM deals mostly with images not videos. Perhaps I misunderstand.
Any way, this is beyond my knowledge and this would be a question for the IM developers to answer.
Any way, this is beyond my knowledge and this would be a question for the IM developers to answer.
Re: Image Stride
I was able to dig this up in BMP.c, line 1583, specifically for the format I'm using (BMP2):
bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32);
So I'm going to assume that stride info is determined privately by each image type handler as needed, and it isn't exposed as a property in the magick image API.
Hope this helps someone else
bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32);
So I'm going to assume that stride info is determined privately by each image type handler as needed, and it isn't exposed as a property in the magick image API.
Hope this helps someone else