image-manipulation

C# - How to change PNG quality or color depth

99封情书 提交于 2019-11-26 22:18:28
问题 I am supposed to write a program that gets some PNG images from the user, does some simple edits like rotation and saves them inside a JAR file so that it can use the images as resources. The problem is when I open, say an 80kb image and then save it with C#, I get an image with the same quality but for 130kb space. And because it has to go inside a J2ME jar file I really need lower sizes, at least the original size. I tried the code below but later found out that it only works for Jpeg

rotating bitmaps. In code

感情迁移 提交于 2019-11-26 22:16:44
Is there a faster way to rotate a large bitmap by 90 or 270 degrees than simply doing a nested loop with inverted coordinates? The bitmaps are 8bpp and typically 2048*2400*8bpp Currently I do this by simply copying with argument inversion, roughly (pseudo code: for x = 0 to 2048-1 for y = 0 to 2048-1 dest[x][y]=src[y][x]; (In reality I do it with pointers, for a bit more speed, but that is roughly the same magnitude) GDI is quite slow with large images, and GPU load/store times for textures (GF7 cards) are in the same magnitude as the current CPU time. Any tips, pointers? An in-place algorithm

How to split an animated gif in .net?

萝らか妹 提交于 2019-11-26 21:40:26
问题 How do you split an animated gif into its component parts in .net? Specifically I want to load them into Image(s) (System.Drawing.Image) in memory. ====================== Based on SLaks' answer i now have this public static IEnumerable<Bitmap> GetImages(Stream stream) { using (var gifImage = Image.FromStream(stream)) { //gets the GUID var dimension = new FrameDimension(gifImage.FrameDimensionsList[0]); //total frames in the animation var frameCount = gifImage.GetFrameCount(dimension); for

Image Processing, In Python? [closed]

会有一股神秘感。 提交于 2019-11-26 21:16:28
I've recently come across a problem which requires at least a basic degree of image processing, can I do this in Python, and if so, with what? The best-known library is PIL . However if you are simply doing basic manipulation, you are probably better off with the Python bindings for ImageMagick , which will be a good deal more efficient than writing the transforms in Python. Depending on what you mean by "image processing", a better choice might be in the numpy based libraries: mahotas , scikits.image , or scipy.ndimage . All of these work based on numpy arrays, so you can mix and match

How can I save an altered image in MATLAB?

删除回忆录丶 提交于 2019-11-26 20:47:20
I want to read an image into MATLAB, draw a rectangle on it, and then save the image. Also, I'm just learning MATLAB--please be gentle. It seems like it should be simple, but I can't seem to do it. im = imread('image.tif'); imshow(im); rectangle('Position', [100, 100, 10, 10]); imwrite(im, 'image2.tif'); Even though I can see the rectangle on the image, the saved image does not display the rectangle. How can I save the image and have the rectangle show up? FWIW, I've already tried saveas() , but that gives me a HUGE image. Is there a way to use saveas() and make the saved image the correct

Rotate image clockwise or anticlockwise inside a div using javascript

為{幸葍}努か 提交于 2019-11-26 20:17:19
问题 HI, Is there a way by which I can rotate an image inside a div clockwise or anticlockwise. I have a main fixed width div[overflow set to hidden] with images loaded from database. There is a scroll bar for showing the images inside the div. When image is clicked then I need to show the rotating animation either in clockwise or anticlockwise direction. I have done it using Matrix filter. I would like to know whether it is possible to be done in IE only without using any filters. 回答1: try this:

Erase bitmap parts using PorterDuff mode

点点圈 提交于 2019-11-26 20:10:12
I try to erase parts of a bitmap in my Android application by using Porter-Duff Xfermodes. I have a green background which is overlayed by a blue bitmap. When I touch the screen a "hole" in the overlaying bitmap is supposed to be created making the green background visible. Instead of a hole my current code produces a black dot. Below is my code. Any ideas, what I am doing wrong here? /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

Combine 2-3 transparent PNG images on top of each other with PHP

自闭症网瘾萝莉.ら 提交于 2019-11-26 19:07:40
问题 I am working on a custom avatar system for a project, but I have never really done much with the image side of PHP. I assume I need to use GD in some way, but I have no idea where to even start. Basically, there are a bunch of pre-made transparent PNG images. Users can select 2-3 of them to customize their avatar, and I want to be able to take these images and make a single image out of them to be stored in a folder. 回答1: $image_1 = imagecreatefrompng('image_1.png'); $image_2 =

How to stretch images with no antialiasing

自作多情 提交于 2019-11-26 18:48:31
So I ran across this recently: http://www.nicalis.com/index.php And I was curious: Is there a way to do this sort of thing with smaller images? I mean, it's pixel art, and rather than using an image with each pixel quadrupled in size couldn't we stretch them with the code? So I started trying to make it happen. I tried CSS, Javascript, and even HTML, none of which worked. They all blur up really badly (like this: http://jsfiddle.net/nUVJt/2/ ), which brings me to my question: Can you stretch an image in-browser without any antialiasing? I'm open to any suggestions, whether it's using a canvas,

Rounded Corners on UIImage

限于喜欢 提交于 2019-11-26 17:53:34
问题 I'm trying to draw images on the iPhone using with rounded corners, a la the contact images in the Contacts app. I've got code that generally work, but it occasionally crashes inside of the UIImage drawing routines with an EXEC_BAD_ACCESS - KERN_INVALID_ADDRESS . I thought this might be related to the cropping question I asked a few weeks back, but I believe I'm setting up the clipping path correctly. Here's the code I'm using - when it doesn't crash, the result looks fine and anybody looking