Languages

Menu
Sites
Language
how to crop image ?

help ,  i want to crop image , like gallery-->edit-->crop.  i can see  a rectangel over the image , the rectangel has several points.  when i drag it ,  it can move and resize .  i want to  implement this function, and crop image .  can anyone help me ? thanks.

now , i  intend to use cairo and Image Util , cairo to draw rectangel, and  image util to crop.   i donnot know whether it is ok .  

Responses

8 Replies
Jean Yang

Hi, 

You can refer bleow tutorial, there are some introduce for crop image, and image processing, hope this can help you.

https://developer.tizen.org/documentation/tutorials/native-application/multimedia/image-util#crop

tom

hi, Jean,thanks your help, i have seen this article,  this information can help me. 

but, i want make  the points (startx,starty,   endx, endy) dynamic,   i want to draw a rectangle  to make serveral points.  Just like tizen mobile  home application. gallery-->edit-->crop.   the question is how can  i draw a dynamic  rectangle  like this ?

Jean Yang

Hi Tom,

I think your request have 2 parts, 

1. make the rectangle to select the crop part image

2. resize and move the the rectangle by touch event?

Am I right?

tom

hi Jean ,  yes, you are right, my question has 2 parts.   can you guide me ?  how to solve this question ? thank you very much.

Jean Yang

Hello Tom,

You can refer below 2 parts:

1, There is an  Native Media sample in IDE, you can create it and find the image part. there has some operation about the image.

2. For touch event, you can find the tutorial in IDE help:Tizen Mobile Native App Programming > Tutorials > UI Tutorials->Multipoint Touch Tutorial

tom

hi , Jean , thanks for your help,  i will follow your guids,  thanks.

Alex Dem

Hi,
just fyi (regarding point 2 ): also maybe this tutorial regarding touch gestures could be useful:
https://developer.tizen.org/dev-guide/2.3.0/org.tizen.tutorials/html/native/ui/gesture_detector_tutorial_n.htm
Alexey.

Alex Dem

fyi: from my experience:
For crop region you could use:
1) Transparency rectangle (for move whole crop region). It should have 1 gesture listener.
2) Small not transparent rectangles or images  (size of 50x50 pixels for example) for corner points, to resize crop region, 4 (or 8 such points). They should have 4 or 8 gesture listeners.
So rectangle and every point have its own gesture listeners, I use ELM_GESTURE_MOMENTUM and coordinates which comes in listeners on ELM_GESTURE_STATE_START, ELM_GESTURE_STATE_MOVE
Alexey.