cropping and rotating an image
Author |
Message |
burmantanya
|
Posted: Sat Nov 22, 2008 2:49 pm Post subject: cropping and rotating an image |
|
|
Hey everyone
can some one guide me with the steps involved on how to crop and rotate and image without using the image module.
for crop, i cannot use the media module thou
your help would be really appreciated..thanx |
|
|
|
|
|
Sponsor Sponsor
|
|
|
burmantanya
|
Posted: Sat Nov 22, 2008 9:56 pm Post subject: RE:cropping and rotating an image |
|
|
ok..i figured out rotating picture..
crop ..i don't even know where to start from :s |
|
|
|
|
|
Zeroth
|
Posted: Sun Nov 23, 2008 12:11 am Post subject: Re: cropping and rotating an image |
|
|
Well, first step would be to define cropping a picture. Then you need to figure out how to access the raw data of an image, and modify that data. Cropping is relatively easy, because in the raw data, its just shaving pixels off. Then just the raw data back into the image format of choice. |
|
|
|
|
|
burmantanya
|
Posted: Sun Nov 23, 2008 11:57 am Post subject: RE:cropping and rotating an image |
|
|
i got the basic outline..
def crop_pic(pic, x1,y1,x2,y2)
for x in range(x1, x2)
for y in range(y1,y2)
get the pixels from the pic and put it into a new pic
how to implement the last step? i mean when we create a new picture, this is what the help section says -
create_picture(w, h, col=Color(255, 255, 255))
Return a Picture w pixels wide and h pixels high.
Default Color col is white.
[def crop_pic(pic, x1,y1,x2,y2):
for x in range(x1, x2):
for y in range(y1,y2):
w = x2 - x1
h = y2 - y1
create_picture(w,h,)
] |
|
|
|
|
|
burmantanya
|
Posted: Sun Nov 23, 2008 11:59 am Post subject: RE:cropping and rotating an image |
|
|
code: |
def crop_pic(pic, x1,y1,x2,y2):
for x in range(x1, x2):
for y in range(y1,y2):
w = x2 - x1
h = y2 - y1
create_picture(w,h,)
|
|
|
|
|
|
|
|
|