crop

How to “crop” a rectangular image into a square with CSS?

六眼飞鱼酱① 提交于 2019-11-27 10:05:43
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 turn this: Into this: Michael Assuming they do not have to be in IMG tags... HTML: <div class="thumb1"> </div> CSS: .thumb1 { background: url(blah.jpg) 50% 50% no-repeat; /* 50% 50% centers image in div */ width: 250px; height: 250px; } .thumb1:hover { YOUR HOVER STYLES HERE } EDIT: If the div needs to link somewhere just adjust HTML and Styles like

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

我是研究僧i 提交于 2019-11-27 10:00:08
问题 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 from x to x+n, like from 30s to 100s. How would I go and do this? I'm reading the man for ffmpeg but this is not really straightforward, especially since I just discovered about ffmpeg and I'm not familiar with audio/video editing softwares, so any

Simple cropping with Paperclip

北战南征 提交于 2019-11-27 09:50:49
问题 I would like to crop images on upload using Paperclip to get square thumbs from the center of the original picture. I find out a method in documentation that seems to do exactly what I want: transformation_to(dst, crop = false) The problem is that I can't figure out where to use this method. It would be great to simply pass something as a parameter here: has_attached_file :picture, :styles => { :medium => "600x600>", :thumb => "something here" } 回答1: You only need to use # instead of > as a

How do I crop an animated gif using ImageMagick?

瘦欲@ 提交于 2019-11-27 09:24:20
问题 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 all this from happening? 回答1: convert input.gif -coalesce -repage 0x0 -crop WxH+X+Y +repage output.gif Animated gifs are often optimised to save space, but imagemagick doesn't seem to consider this when applying the crop command and treats each frame

Android大图片裁剪终极解决方案(中:从相册截图)

戏子无情 提交于 2019-11-27 09:03:28
转 载 声明: Ryan的博客文章欢迎您的转载,但在转载的同时,请注明文章的来源出处,不胜感激! :-) http://my.oschina.net/ryanhoo/blog/86853 在这篇博客中,我将向大家展示如何从相册截图。 上一篇博客中,我就拍照截图这一需求进行了详细的分析,试图让大家了解Android本身的限制,以及我们应当采取的实现方案。 根据我们的分析与总结,图片的来源有拍照和相册,而可采取的操作有 使用Bitmap并返回数据 使用Uri不返回数据 前面我们了解到,使用Bitmap有可能会导致图片过大,而不能返回实际大小的图片,我将采用大图Uri,小图Bitmap的数据存储方式。 我们将要使用到URI来保存拍照后的图片: private static final String IMAGE_FILE_LOCATION = "file:///sdcard/temp.jpg";//temp file Uri imageUri = Uri.parse(IMAGE_FILE_LOCATION);//The Uri to store the big bitmap 不难知道,我们从相册选取图片的Action为Intent.ACTION_GET_CONTENT。 根据我们上一篇博客的分析,我准备好了两个实例的Intent。 一、从相册截大图: Intent intent = new

Android大图片裁剪终极解决方案(下:拍照截图)

随声附和 提交于 2019-11-27 09:03:13
转 载 声明: Ryan的博客文章欢迎您的转载,但在转载的同时,请注明文章的来源出处,不胜感激! :-) http://my.oschina.net/ryanhoo/blog/86865 上一篇博客 中,我们学习到了如何使用Android相册截图。在这篇博客中,我将向大家展示如何拍照截图。 拍照截图有点儿特殊,要知道,现在的Android智能手机的摄像头都是几百万的像素,拍出来的图片都是非常大的。因此,我们不能像对待相册截图一样使用Bitmap小图,无论大图小图都统一使用Uri进行操作。 一、首先准备好需要使用到的Uri: private static final String IMAGE_FILE_LOCATION = "file:///sdcard/temp.jpg";//temp file Uri imageUri = Uri.parse(IMAGE_FILE_LOCATION);//The Uri to store the big bitmap 二、使用MediaStore.ACTION_IMAGE_CAPTURE可以轻松调用Camera程序进行拍照: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);//action is capture intent.putExtra(MediaStore.EXTRA

Crop for SpatialPolygonsDataFrame

断了今生、忘了曾经 提交于 2019-11-27 08:01:41
I have two SpatialPolygonsDataFrame files: dat1, dat2 extent(dat1) class : Extent xmin : -180 xmax : 180 ymin : -90 ymax : 90 extent(dat2) class : Extent xmin : -120.0014 xmax : -109.9997 ymin : 48.99944 ymax : 60 I want to crop the file dat1 using the extent of dat2. I don't know how to do it. I just handle raster files using "crop" function before. When I use this function for my current data, the following error occurs: > r1 <- crop(BiomassCarbon.shp,alberta.shp) Error in function (classes, fdef, mtable) : unable to find an inherited method for function ‘crop’ for signature

Delphi - how do I crop a bitmap “in place”?

六月ゝ 毕业季﹏ 提交于 2019-11-27 07:43:24
问题 If I have a TBitmap and I want to obtain a cropped image from this bitmap, can I perform the cropping operation "in place"? e.g. if I have a bitmap that is 800x600, how can I reduce (crop) it so that it contains the 600x400 image at the centre, i.e. the resulting TBitmap is 600x400, and consists of the rectangle bounded by (100, 100) and (700, 500) in the original image? Do I need to go via another bitmap or can this operation be done within the original bitmap? 回答1: You can use the BitBlt

swift: how to delete part of audio?

。_饼干妹妹 提交于 2019-11-27 07:24:18
问题 I'm creating a simple audio editing tool to trim and delete from an audio. I implemented the trim function and it is working fine. However I searched and tried to implement the delete function and here is my code: func deleteExportAsset(_ asset: AVAsset, fileName: String, completeAudioTime: CGFloat) -> URL { print("\(#function)") let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] let trimmedSoundFileURL = documentsDirectory

Crop square image to circle - Programmatically

前提是你 提交于 2019-11-27 06:45:56
i was searching for past one day and i was not successful . i get the image from API , and i download it to a bitmap file using the following code . private Bitmap DownloadImage(String URL) { Bitmap bitmap = null; InputStream in = null; try { in = OpenHttpConnection(URL); bitmap = BitmapFactory.decodeStream(in); in.close(); } catch (IOException e1) { e1.printStackTrace(); } return bitmap; } private InputStream OpenHttpConnection(String urlString) throws IOException { InputStream in = null; int response = -1; URL url = new URL(urlString); URLConnection conn = url.openConnection(); if (!(conn