Split image in python based on custom defined mask - image-processing

I have several images with each image having grid of small images with different sizes with white background. I want to separate each small image from the bigger grid image and save it separately . How can I achieve this in python ?
content and size of small images keeps on changing with large image to image, only thing which is constant is white background to separate each small image as shown below.
sample image

Related

iOS - Size of Image vs. Size of ImageView

just want to see if I'm on the right track here is understanding the performance trade-offs of placing various image sizes into image views.
If I have a large image, will the image load faster if I place it in a correspondingly large imageView versus placing it in a smaller imageView?
No, the loading time depends on the file, and if the image is large, and its file Size is large, it will load slower than a small images on the same image View.
To make it clear, image view doesn't affect loading performance, image size (File size) does affect performance.
Answering you r question first, size of image is not directly proportional to imageview i.e. regardless of your imageview size, you image will take time based on the size of image.
Now, if you have a task in which you need to show user images & on click you need to share that image, you need to maintain 2 copies for showing take resized copy & while sharing pick image from original position. In this way, your loading will be fast & while sharing you will be able to share original image itself.

ImageMagick stretchable image

In iOS there is a concept of stretchable images, i.e. a way to define regions of an image where the underlying image data can be duplicated in an aesthetically pleasing way:
Is there any way to specify this with ImageMagick's resize option (for instance as part of a composition operation)?
My final goal is to have this kind of overlay fit nicely to any aspect ratio of background picture:

how to load image from camera for specific/variable sizes?

I have a very simple requirement here but I'm looking for a solution for a while. I want to take a profile picture form the camera roll or camera and display it in two different image views (different sizes). I don't want any of these images stretched or miss any part of the image. If I use aspect to fit, top side of image is cut from smaller image view and some parts missing on the bigger image view. If I set it as scale to fit, it will get stretched!
I'm not sure how some mobile apps work. Do they save different image sizes in their server or they change the size of the image. I saw many posts how to change image size without changing aspect ratio. But I don't think it is possible to avoid stretched effects. I used some of those code to change size of image, it gets stretched all the time.
Is there any way to save the image from camera roll one time with size of 140*200 and one time 160*200? So I can use 140*200 for image views that size. But what if I have different devices and different sizes.

Hide smaller image portion, not overlapping with larger image in the background

I have two images, one larger than the other. My need is to be able to drag and place the smaller image anywhere above the larger one. The problem is that, I don't want the portion of the smaller image outside the larger image's boundary to be seen. Once the smaller image's non-transparent portion stops overlapping the larger image non-transparent portion, the non-overlapping smaller image portion should be hidden.However, when the smaller image is completely inside the larger image's non-transparent portion, it should be visible.!
[For eg., the image shown consists of a larger image that is a T-shirt and a smaller image that is of a lady.I want to add the image of the lady over the T-shirt. It should be possible to move the image of the lady anywhere inside the T-shirt.And once the image of the lady moves out of the T-shirt's outer black boundary the non-overlapping portion of the image of the lady should become transparent. Here, the portion of the T-shirt image outside the black boundary is transparent. Can someone help me with the code?
Your requirement is a pretty complex one. If the "T-Shirt" part is static than again it is easy for you to mark boundaries for that image. But if there is different background than you need to do more stuff.
Here you have to take a help of Core image. You need to process that image and get the core details of that image. Also "Morphological Operations" will help you to detect object from image. Take a look on links:
Core image processing
Morphological Operations
Also about the drag and drop follow this one.
OBDragDrop

How to get rid of empty transparent areas in a PNG image so that it conforms to actual image size?

I have a series of images that I would look to loop through using iOS's [UIView startAnimating]. My trouble is that, when I exported the images, they all came standard in a 240x160 size, although only 50x50 contains the actual image, the rest being transparent parts that are just taking up space.
When I set the frame of the image automatically using image.size.width and image.size.height, iOS takes into images' original size of 240x160, so I am unable to get a frame that conforms to the actual parts of the image. I was wondering if there is a way using Illustrator or Photoshop, or any other graphics editing software for me to export the images based on their natural dimensions, and not a fixed dimension. Thanks!
I am a fan of vector graphics and thinks everything in the world should be vector ;-) so here is what you do in illustrator: file - document setup - edit artboards. Then click on the image, and the artboard should adjust to the exact size. You can of course have multiple artboards, or simply operate with one artboard and however-many images.

Resources