deleting every other line in an image

Jim Ault JimAultWins at yahoo.com
Mon Nov 12 19:05:04 EST 2007


Why not use the Thumbnail Stack that Eric Chatonet has on his tutorial page?
Just use 1/2 * the Height and get a smoother jpg since you will be sampling
to get the smaller image.

No need for all the looping and slow pixel-by-pixel work.

Jim Ault
Las Vegas


On 11/12/07 3:34 PM, "BNig" <niggemann at uni-wh.de> wrote:

> 
> Hi Josh,
> 
> make a stack with 2 images, call them "P1" and "P2"
> load a picture in the inspector into image "p1"
> set the width and height to 140 in the inspector
> 
> make a new button
> 
> paste this script into the button
> 
> on mouseUp
>     put the width of image "P1" into theImagWidth
>     put the height of image "P1" into theImageHeight
>     put the imagedata of image "P1" into theDataToWorkon
>     if theDataToWorkon = "" then exit mouseUp
>     put length (theDataToWorkon) into HowLong
>     put empty into destImageData
>     
>     -- one Pixel = 4 Bytes = 4 chars
>     put theImagWidth * 4 into OneRowOfImage
>     put theImageHeight into soManyPixelRows
>     
>     put 0 into theCounter
>     repeat   with i = 1 to (HowLong - OneRowOfImage) step (OneRowOfImage*2)
>         put  char i to (i + OneRowOfImage-1) of theDataToWorkon  after
> destImageData
>     end repeat
>     
>     set the width of image "P2" to theImagWidth
>     -- watch out for images with uneven heigths
>     set the height of image "P2" to (theImageHeight/2)
>     set the imagedata of image "P2" to destImageData
> end mouseUp
> 
> this should give you in "P2" an image half the height of P1 with every
> second line of the original image.
> 
> it works for me, attention, almost no error checking in here,
> it is important to have the width and height correct otherwise the image
> will be distorted
> 
> just curious: why do you want to eliminate every second line of an image?
> 
> hth
> 
> Bernd
> 
> 
> 
> Josh Mellicker wrote:
>> 
>> Here's one for the image processing gurus out there:
>> 
>> How difficult is it to take an image, and create a new image
>> containing every OTHER line from it (e.g., just the odd lines) so the
>> resulting picture is half the height?
>> 
>> Once you knew the width of the image, isn't it just a loop that
>> copies tWidth pixels, then skips the next tWidth, and so on?
>> 
>> Thanks!
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>> 
>> 





More information about the use-livecode mailing list