Hi Josh, this script works with your picture but gives you an image half the width and heigth of the original
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 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 -- now set the width to half set the width of image "P2" to (theImagWidth/2) end mouseUp I had it adapted to double the lines but that is what masmit did in his script, that keeps the original size of the image. Scaling it down gives a crisper image as far as I see. all the best bernd Josh Mellicker wrote: > > Hello Bernd, > > I tried and tried but could not get the script to work. > > It produces an image with half the content widthwise, and I am still > trying to get it to copy every other complete line... > > Here is a typical source image: > > http://revcoders.org/resources/temp.png > > You can see the obvious interlacing, as the dolphin was saying "yes" > to the question "would you like a fish?" > > I am attempting to copy every other line to a new image, then set the > width to half as well so the picture maintains its aspect ratio. > > Does your script work with that image? > > Thanks! > > > On Nov 12, 2007, at 3:34 PM, BNig 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@lists.runrev.com >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-revolution >>> >>> >> >> -- >> View this message in context: http://www.nabble.com/deleting-every- >> other-line-in-an-image-tf4793676.html#a13716667 >> Sent from the Revolution - User mailing list archive at Nabble.com. >> >> _______________________________________________ >> use-revolution mailing list >> use-revolution@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-revolution > > _______________________________________________ > use-revolution mailing list > use-revolution@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution > > -- View this message in context: http://www.nabble.com/deleting-every-other-line-in-an-image-tf4793676.html#a13743052 Sent from the Revolution - User mailing list archive at Nabble.com. _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution