crop

How to crop pdf using Ghostscript (without entering manually Bounding Box)

烈酒焚心 提交于 2019-12-11 02:56:48
问题 I need to crop a pdf-file to its Bounding Box. First I calculate actual Bounding Box: gswin64c.exe ^ -o nul ^ -sDEVICE=bbox ^ input.pdf the result %% HiResBoundingBox: 156.350019 391.521011 445.919963 446.259010 I substitute into the gswin64c.exe ^ -o output.pdf ^ -sDEVICE=pdfwrite ^ -dUseCropBox=true ^ -c "[/CropBox [156.350019 391.521011 445.919963 446.259010] /PAGES pdfmark" ^ -f input.pdf is there a way to substitute the Bounding Box automatically? thank you. 回答1: What you need is called

crop image with fixed x/y ratio

有些话、适合烂在心里 提交于 2019-12-11 02:55:24
问题 I want to crop image using following code. but i want to user only can select the crop area with a predefined x/y ratio.for example if x=2,y=2 ,then user can only use mouse to select an area with (x/y)=1 ratio. I = imread('image.jpg'); [rows columns numberOfColorBands] = size(I); I2 = imcrop(I); imshow(I), figure, imshow(I2) 回答1: You could use imrect to produce the coordinates, and then pass those into imcrop. figure, imshow(I); h = imrect(gca,[10 10 100 100]); setFixedAspectRatio(h,1); %

How to crop multiple rectangles or squares from JPEG?

情到浓时终转凉″ 提交于 2019-12-11 02:32:13
问题 I have a jpeg from where I want to crop a portion containing graph (the one in the bottom portion). As of now I used this code to achieve the same: from PIL import Image img = Image.open(r'D:\aakash\graph2.jpg') area = (20, 320, 1040, 590) img2 = img.crop(area) # img.show() img2.show() But I achieved this by guessing the x1, y1, x2, y2 multiple times to arrive at this (guess work). Image before cropping: Image after cropping: I'm totally novice in image cropping based on some logic. How can I

cropping images from center on the fly - Javascript?

故事扮演 提交于 2019-12-11 02:28:13
问题 I have a bunch of images, that are various sizes, in terms of width and height. Some are square, some are rectangle, but I'd like all of them to be width and height of my choice. I know I can use the width="" and height="" in the So, what I was looking for, is a possible javascript solution, maybe using jQuery, that will crop the images from center on the fly? Is this possible? 回答1: You can position the images within a container using CSS. Then ensure overflow: hidden is set on that container

How to get the right image data in base64 format using HTML5 canvas

别说谁变了你拦得住时间么 提交于 2019-12-11 02:26:34
问题 I'm trying to crop a image using ctx.drawImage() and get the cropped image data using canvas.toDataURL(). However I can't get the right data until I refresh the page few times. I want to know how can I get the cropped image data immediately instead of refresh the page. <script> var imageObj = new Image(); imageObj.src = 'http://localhost:63342/war/img/IMG_20140131_102234.jpg'; var canvas = document.createElement('canvas'); canvas.width = 30; canvas.height = 30; // Copy the image contents to

Trouble cropping and resizing image

僤鯓⒐⒋嵵緔 提交于 2019-12-11 02:25:06
问题 I'm trying to create a thumbnail image for a larger image. I'm using Jcrop to get the co-ordinates of the crop but I can't turn this into a properly cropped thumbnail image. I've set up Jcrop properly and it's sending through x-y co-ordinates along with the size of the box but I can't work out how to crop from that. What I have is the path to an image on my server, along with 4 co-ordinates and the width and height of the square box they create (I've locked the aspect ratio to 1:1 as I want

Crop and save visible region of UIImageView using AspectFill

◇◆丶佛笑我妖孽 提交于 2019-12-11 01:49:56
问题 I have a fullscreen UIImageView with a image in it set to AspectFill (full bleed), how can I save only the visible portion of the image when its using the Aspect Fill content mode? CGRect visibleRect; visibleRect.size= mImageView.frame.size; CGImageRef cropped_img = CGImageCreateWithImageInRect(mImageView.image.CGImage, visibleRect); UIImage *finalImage = [[UIImage alloc]initWithCGImage:cropped_img]; UIImageWriteToSavedPhotosAlbum(finalImage, nil, nil, nil); This is my current code, cropping

Trying to use only a portion of a SKTexture using textureWithRect inTexture

自闭症网瘾萝莉.ら 提交于 2019-12-10 23:55:13
问题 What I'm doing is create a SKTexture based on the full image SKTexture *fullTexture = [SKTexture textureWithImageNamed:@"fullImage"]; I want to use the full width of the fullTexture, but only a portion of height of the texture, BUT, starting from the TOP of the full image. After figuring out that the width seems to be in percentage, I used the following code: SKTexture *croppedTexture = [SKTexture textureWithRect: CGRectMake(0,0,1,percentageY) can somebody give me the correct float values for

CSS - How to crop an image to a square, if it's already square then resize it

梦想与她 提交于 2019-12-10 23:22:31
问题 Let's say that I have an image with 250 width and 250 height and I want to crop it to 90x90 It will show me pixels from the image, but I want to crop it if it is rectangle and resize it if it's square, So how can I do it? This is the CSS code that crops the image, but how do I resize it? .image{ width:90px; height:90px; } .image{ display: block; overflow:hidden; clip:rect(0px,90px,90px,0px); } 回答1: METHOD 1 Will work for horizontal rectangle images (larger in width), if you need vertical

ImageMagick Crop Square from Circle?

♀尐吖头ヾ 提交于 2019-12-10 23:12:29
问题 I have a 424x318 image that I "draw" a circle into and leave the rest transparent. I want to then take that circle and crop it out. How can I do this? My function (the bash variables are just the normal stuff, $SCALEFILE is the file, $NEWFILE is what it saves it as and $SIZE is just the normal size string x0,y0 x1,y1) convert -size 416x318 xc:none -fill $SCALEFILE -draw "circle $SIZE" $NEWFILE ps. my circle dimensions change. Thanks! 回答1: You can use -crop WxH+X+Y +repage to crop to the