image-manipulation

Resize an image without reading it again from disk?

穿精又带淫゛_ 提交于 2019-12-08 08:24:36
问题 I need to resize an image based on it's longest side, e.g. longest side - which can be width or height - should be only 100 pixels long. Currently I am using this method: private Image resizeImageByLongestSide(File imageFile, int lengthLongestSide) { String uri ="file:" + imageFile.getAbsolutePath(); Image image = new Image(uri); // raed to determine width/height // read image again for resizing if(image.getWidth() >= image.getHeight()) return new Image(uri, lengthLongestSide, 0, true, false)

Gray scale image to color

柔情痞子 提交于 2019-12-08 08:14:56
问题 Is there a way to convert a gray-scale image to a colour image? Here's a few JPG examples Photo 1 Photo 2 Photo 3 ImageMagick is powerful but doesn't seem capable of converting to a colourful version. 回答1: Unfortunately this is not possible. Grayscale images do not contain sufficient information to create a color image. In instances where you see B&W/Grayscale images converted to color, this has been done manually in an application such as photoshop. You can use imagemagick to apply a filter

PHP resize image before save to mysql database?

回眸只為那壹抹淺笑 提交于 2019-12-08 07:29:25
问题 After I got the post, how to resize to a smaller width (maximum width is 80, min also 80) and what should I check for security purposes? My current code: if(!empty($_FILES)) { # Resize Image function $return=true; function resizeImage($originalImage,$toWidth,$toHeight){ // Get the original geometry and calculate scales list($width, $height) = getimagesize($originalImage); $xscale=$width/$toWidth; $yscale=$height/$toHeight; // Recalculate new size with default ratio if ($yscale>$xscale){ $new

Loading large background images in cocos2d

爷,独闯天下 提交于 2019-12-08 07:27:33
Im working on an iphone platforms game developed using cocos2d and box2d which has to use a very large image as a background, my question is this: -which is the better way to load the image?? (I'm talking about an image which can be 14K pixels long), is it better to cut in smaller images an keep loading them as the player moves?? -Should I keep in memory as invisible or use the addChild method to load them as I need them and the removeChild to remove the previous one? Thanks in advance, any answer will be welcome :) You can't use textures larger then 1024x1024 or 2048x2048 for iphone/ipod 4

Loading large background images in cocos2d

核能气质少年 提交于 2019-12-08 06:38:01
问题 Im working on an iphone platforms game developed using cocos2d and box2d which has to use a very large image as a background, my question is this: -which is the better way to load the image?? (I'm talking about an image which can be 14K pixels long), is it better to cut in smaller images an keep loading them as the player moves?? -Should I keep in memory as invisible or use the addChild method to load them as I need them and the removeChild to remove the previous one? Thanks in advance, any

Remove shapes from image with X number of pixels or less

你说的曾经没有我的故事 提交于 2019-12-08 06:22:30
问题 If I have a image with, let's say squares. Is it possible to remove all shapes formed by 10 (non white) pixels or less and keep all shapes that is formed by 11 pixels or more? I want to do it programmatically or with a command line. Thanks in advance! 回答1: There are a couple of ways to approach this. What you are referring to is commonly called Despeckle in Document Imaging Applications. Document scanners often introduce a lot of dirt and noise into an image during scanning and so this must

jQuery resize image before saving

元气小坏坏 提交于 2019-12-08 05:34:26
I am new to jQuery but im loving it! ive have a problem i cant get round as of yet. I am using http://www.zurb.com/playground/ajax_upload which i have got working using the following upload.php <? $time= time(); $uploaddir = 'users/'; //<-- Changed this to my directory for storing images $uploadfile = $uploaddir.$time.basename($_FILES['userfile']['name']); //<-- IMPORTANT if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo $uploaddir.$time.$_FILES['userfile']['name']; // IMPORTANT #print_r($_FILES); } else { // WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE! //

Bufferedimage into circle shape

ε祈祈猫儿з 提交于 2019-12-08 03:48:51
问题 I have a buffered image from byte array. How do I make the image into a circle? Crop? I don't want a circle, I want the orginal image to become circle shape and display def bufferedImage = imgSvc.convertByteArrayToBufferedImage(crop.image) 回答1: If bufferedImage is squared, then with this code : int width = bufferedImage.getWidth(); BufferedImage circleBuffer = new BufferedImage(width, width, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = circleBuffer.createGraphics(); g2.setClip(new Ellipse2D

Simple WPF page selection for multipaged tiff

前提是你 提交于 2019-12-08 01:03:40
问题 I am making a basic Tiff viewer and need to be able to select the page to be viewed. In Winforms I could use selectActiveFrame, so I was wondering if there is a WPF equivalent for this. Thanks! EDIT: In winforms I used System.Drawing.Imaging.FrameDimension in the selectActiveFrame method if that helps at all. 回答1: You can use the TiffBitmapDecoder class to load the image and then use the Frames property to access which tiff frame you like. 来源: https://stackoverflow.com/questions/4546994

Permanently-Caching images in GWT

给你一囗甜甜゛ 提交于 2019-12-07 14:52:34
问题 What's difference between cache & permanently cache in browser. In GWT framework image files rename to .cache. pattern and I read somewhere in google website to cache permanently images in GWT configure the App-Server for caching them permanently. But I don't know how to do this exactly. My website's images will never changed and I want to cache them forever without any version checking (for best performance) Yours sincerely 回答1: ClientBundle introduced in GWT 2.0 allows you to bundle images