image-manipulation

Convert a image to a monochrome byte array

自作多情 提交于 2019-11-27 08:26:49
问题 I am writing a library to interface C# with the EPL2 printer language. One feature I would like to try to implement is printing images, the specification doc says p1 = Width of graphic Width of graphic in bytes. Eight (8) dots = one (1) byte of data. p2 = Length of graphic Length of graphic in dots (or print lines) Data = Raw binary data without graphic file formatting. Data must be in bytes. Multiply the width in bytes (p1) by the number of print lines (p2) for the total amount of graphic

iPhone - having a Ripple effect on a UIImageView

牧云@^-^@ 提交于 2019-11-27 08:08:39
I am attempting to create a ripple like effect on an imageView when it is touched down on, however I do not understand how to implement OpenGL for windows and porting it to iOS. I have attempted to use http://www.codeproject.com/KB/openGL/dsaqua.aspx as well as cocos2d however I find the latter completely and utterly confusing. Would anyone be willing to give some suggestions or can point me in the right direction? Many thanks! Jhaliya Use below for ripple effect in iPhone [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1.0]; [UIView setAnimationTransition:

iOS images in a bubble effect

别来无恙 提交于 2019-11-27 07:43:30
I have some images that I want to "put inside a bubble". The bubbles kind of float around the screen with these images trapped inside them. The best is a way to combine the inside image with the bubble image and somehow warp the inside image to look like it is reflected on the inside of the bubble. Does anyone know how to achieve this effect without using textures and meshes? Perhaps someone remembers an old project or something that did something similar? Here is an example of what I mean: Brad Larson You can do this using the GPUImageSphereRefractionFilter from my open source GPUImage

resize image on save

陌路散爱 提交于 2019-11-27 07:29:14
How can I easily resize an image after it has been uploaded in Django? I am using Django 1.0.2 and I've installed PIL. I was thinking about overriding the save() method of the Model to resize it, but I don't really know how to start out and override it. Can someone point me in the right direction? Thanks :-) @Guðmundur H: This won't work because the django-stdimage package does not work on Windows :-( You should use a method to handle the uploaded file, as demonstrated in the Django documentation . In this method, you could concatenate the chunks in a variable (rather than writing them to disk

Can I access ImageMagick API with Python?

天涯浪子 提交于 2019-11-27 06:52:47
I need to use ImageMagick as PIL does not have the amount of image functionality available that I am looking for. However, I am wanting to use Python. The python bindings (PythonMagick) have not been updated since 2009. The only thing I have been able to find is os.system calls to use the command line interface but this seems clunky. Is there any way to access the API directly using ctypes and conversions of some sort? As a last resort is there any other library out there that has the extensive amount of image editing tools like ImageMagick that I have looked over? I would recommend using Wand

How to mirror an image file? (2.2+)

痴心易碎 提交于 2019-11-27 06:45:27
问题 I have a PNG file that I want to use for an overlay - however, this file has to be mirrored (and rotated by 180°), but in order to save space, I don't want to place the mirrored file in the apk, but do this action programmatically. How can I do this with Froyo and above? 回答1: Scaling by -1.0 causes the image to be flipped. Assuming bmp is the bitmap you want to mirror (here on the x axis) you can do : Matrix matrix = new Matrix(); matrix.preScale(-1.0f, 1.0f); Bitmap mirroredBitmap = Bitmap

Client-side conversion of rgb-jpg to 8-bit-jpg using Canvas+HTML5

旧巷老猫 提交于 2019-11-27 06:33:15
问题 Many articles shows ways of converting jpeg files to grayscale using canvas+html5 at the client-side. But what I need is to convert an image to 8bit grayscale to reduce its size before uploading to my server. Is it possible to do it using canvas+html5? 回答1: The whatwg specification mentions a toBlob method, which is supposed to convert the canvas to a jpeg or png and give you the binary representation. Unfortunately, it isn't widely supported yet. So all you can do is use getImageData to get

PHP/GD - Cropping and Resizing Images

一个人想着一个人 提交于 2019-11-27 06:07:40
问题 I've coded a function that crops an image to a given aspect ratio and finally then resizes it and outputs it as JPG: <?php function Image($image, $crop = null, $size = null) { $image = ImageCreateFromString(file_get_contents($image)); if (is_resource($image) === true) { $x = 0; $y = 0; $width = imagesx($image); $height = imagesy($image); /* CROP (Aspect Ratio) Section */ if (is_null($crop) === true) { $crop = array($width, $height); } else { $crop = array_filter(explode(':', $crop)); if

PIL how to scale text size in relation to the size of the image

醉酒当歌 提交于 2019-11-27 05:39:25
问题 I'm trying to dynamically scale text to be placed on images of varying but known dimensions. The text will be applied as a watermark. Is there any way to scale the text in relation to the image dimensions? I don't require that the text take up the whole surface area, just to be visible enough so its easily identifiable and difficult to remove. I'm using Python Imaging Library version 1.1.7. on Linux. I would like to be able to set the ratio of the text size to the image dimensions, say like 1

resize image on save

余生长醉 提交于 2019-11-27 03:59:21
问题 How can I easily resize an image after it has been uploaded in Django? I am using Django 1.0.2 and I've installed PIL. I was thinking about overriding the save() method of the Model to resize it, but I don't really know how to start out and override it. Can someone point me in the right direction? Thanks :-) @Guðmundur H: This won't work because the django-stdimage package does not work on Windows :-( 回答1: You should use a method to handle the uploaded file, as demonstrated in the Django