Questions tagged [crop]

Crop refers to any issues relating to cropping images.

Cropping refers to the removal of the outer parts of an image to improve framing, accentuate subject matter or change aspect ratio.

Image example :

enter image description here

3129 questions
249
votes
14 answers

How to "crop" a rectangular image into a square with CSS?

I know that it is impossible to actually modify an image with CSS, which is why I put crop in quotes. What I'd like to do is take rectangular images and use CSS to make them appear square without distorting the image at all. I'd basically like to…
novicePrgrmr
  • 18,647
  • 31
  • 81
  • 103
196
votes
4 answers

How to crop an image using PIL?

I want to crop image in the way by removing first 30 rows and last 30 rows from the given image. I have searched but did not get the exact solution. Does somebody have some suggestions?
Taj Koyal
  • 2,023
  • 2
  • 13
  • 3
162
votes
10 answers

Android Crop Center of Bitmap

I have bitmaps which are squares or rectangles. I take the shortest side and do something like this: int value = 0; if (bitmap.getHeight() <= bitmap.getWidth()) { value = bitmap.getHeight(); } else { value = bitmap.getWidth(); } Bitmap…
Maurice
  • 6,413
  • 13
  • 51
  • 76
109
votes
18 answers

What's the algorithm to calculate aspect ratio?

I plan to use it with JavaScript to crop an image to fit the entire window. Edit: I'll be using a 3rd party component that only accepts the aspect ratio in the format like: 4:3, 16:9.
Nathan
  • 4,017
  • 2
  • 25
  • 20
82
votes
4 answers

How do I crop an animated gif using ImageMagick?

There's plenty of information about cropping images, but attempting to crop (or trim) animations produces strange results. Sometimes they flicker, or come with extra frames, or some frames crop correctly and others become offset. How do I prevent…
jimmetry
  • 2,141
  • 2
  • 16
  • 12
79
votes
2 answers

How to crop a mp3 from x to x+n using ffmpeg?

Following this question I decided to use ffmpeg to crop MP3s. On another question I found this way of doing it: ffmpeg -t 30 -acodec copy -i inputfile.mp3 outputfile.mp3 The problem is that I don't want to crop the first 30 seconds, I want to crop…
marcgg
  • 65,020
  • 52
  • 178
  • 231
72
votes
4 answers

How to auto center crop ImageView Android?

I made a listView images. My goal that each item of my listView have the same height of 100dp. I encounter a problem that my imageView is resized automatically, but does not take the entire space of the parent. Here is my current result and objectif…
lopez.mikhael
  • 9,943
  • 19
  • 67
  • 110
70
votes
6 answers

Crop a Bitmap image

How can i crop a bitmap image? this is my question i have tried some concepts using intents but still fail.. I am having a bitmap image which i want to crop!! here is the code : Intent intent = new Intent("com.android.camera.action.CROP"); …
user2134412
67
votes
11 answers

Detect face then autocrop pictures

I am trying to find an app that can detect faces in my pictures, make the detected face centered and crop 720 x 720 pixels of the picture. It is rather very time consuming & meticulous to edit around hundreds of pictures I plan to do that. I have…
AisIceEyes
  • 825
  • 2
  • 9
  • 10
65
votes
8 answers

Crop image in PHP

The code below crops the image well, which is what i want, but for larger images, it wotn work as well. Is there any way of 'zooming out of the image' Idealy i would be able to have each image roughly the same size before cropping so that i would…
user195257
  • 3,186
  • 5
  • 36
  • 49
59
votes
23 answers

How to Split Image Into Multiple Pieces in Python

I'm trying to split a photo into multiple pieces using PIL. def crop(Path,input,height,width,i,k,x,y,page): im = Image.open(input) imgwidth = im.size[0] imgheight = im.size[1] for i in range(0,imgheight-height/2,height-2): …
Elteroooo
  • 2,913
  • 3
  • 33
  • 40
58
votes
8 answers

Command line batch image cropping tool

is there any lightweight command line batch image cropping tool(Linux or Windows) which can handle a variety of the formats ?
iceman
  • 4,211
  • 13
  • 65
  • 92
54
votes
7 answers

How to fit Image into ImageView using Glide

My concern is how to fit image using android:scaleType="fitXY" into image using Glide. My ImageView is
N J
  • 27,217
  • 13
  • 76
  • 96
49
votes
1 answer

Cropping a PDF using Ghostscript 9.01

I am not a programmer, but would like to learn how to crop a PDF using Ghostscript. I have installed Ghostscript 9.01 in my machine. Please guide me step by step process (starting from invoking Ghostscript) to crop a PDF with the specific…
AMER
  • 971
  • 2
  • 10
  • 9
47
votes
6 answers

crop center portion of a numpy image

Let's say I have a numpy image of some width x and height y. I have to crop the center portion of the image to width cropx and height cropy. Let's assume that cropx and cropy are positive non zero integers and less than the respective image size.…
Gert Gottschalk
  • 1,658
  • 3
  • 25
  • 37
1
2 3
99 100