- Posted by Kasey <kaseyb at GEOCITIES.COM> Mar 09, 1998
- 1753 views
Andrew Mitchell wrote: > > How do I clip an image that has been loaded by read_bitmap()? > I am trying to fit a large picture into a 533x370 area. > I have the following section to clip the width that doesn't work. > It does run all of the lines, and length(tmp_img) is 800 > > if length(tmp_img) > 533 then > tmp_img1=tmp_img[1..533] > tmp_img=tmp_img1 > end if > display_image({11,49},tmp_img1) > > I thought that it would look like this: > > 000001111 > 000001111 > 000001111 > 000001111 > 111111111 > 111111111 > > with 0's being the part I want to display I'm still learning euphoria, but it looks like what your doing is trimming the last x bytes off of the image : 00000000 00000000 00000000 000000xx xxxxxxxx is what your getting, right? so what you need to do is get the x (higth) and y (width) of your image (the original)and run, through 2 loops: (psudo code follows) for h = 1 to 533 for w = 1 t y if w < 370 then temp_img_2 =apend(temp_image_2, Original_imag((h*(y-1))+w)) next w next h what you want to do is step through the first 533 rows and apend to your new image every pixel value that is in a colum before #371. and just skip all the rest. I've just begun to learn euphoria so I couldn't write actual euphoria code, but I'm shure of the basic algorithym. Kasey