Is there an easy way to render an SVG-image resulting in an image-object or a bitmap byte-array (Not saving the file in another type but just put it as an image in main memory)?
You could have a look at Mono.Cairo, which is a low-level vector library for Mono. Here is an example for loading images, including SVG.
Related
I have a bunch of animated vector graphic files that I would like to convert to bodymovin (I assume I would need to convert them into after effects first and use the bodymovin extension).
I animated files in swf, fla, svg (using the animate element inside the svg), snap and sprite.js html5 formats. I need to preserve the animations (recreating them is not an option)
Is this possible? Any ideas?
I have imported one of my animated swfs directly into after effects and exported to an mp4 but it won't export to bodymovin (I think swf and the vector graphics are very different)
I had the same problem. You should get Bodymovin plugin for Adobe Animate CC. Have a look here: https://github.com/airbnb/lottie-web/issues/1604
Is there at least some way to get a picture of a .obj model without displaying the model ?
I have a lot of .obj models and I need to convert them to .png images.
I need only image without display anything
You don't really need libgdx for obj rendering. This can be done by either opengl, or some custom render libs.
Consider using this library written in c++ for obj rendering. Here's its description in russian
Do you need to do this in libgdx? I think you can also call blender via command line, let it render the scene and output to an image. Make a short bash script to do this for all .obj files in your folder.
If you do need to use libgdx, I think a good approach is to render to a framebuffer, then write its contents to a file.
I opened one PNG file in Inkscape and exported it as SVG. When I opened that file with notepad I came to know that the PNG file is embedded within it. If the conversion happened then the resulting file should have only SVG related tags. It shouldn't embed the image within it. Or Am I doing anything wrong.
Note: Save as option also producing the same kind of file. I am using Inkscape version 0.48 in Windows 7 - 64 bit.
This is a bit of an old thread, but it comes up early in Google so I thought I'd contribute something.
In Inkscape, you must do a trace to change the image into SVG. Look at the Path | Trace bitmap menu item and play with the options on that screen.
After creating the trace, you can remove your source image and have a pure svg in your saved file.
I've found it helpful to create layers in Inkscape and move the source image to one layer and put the trace on another layer to let me make quick comparisons using the 'hide layer' buttons.
BTW, your source image can be anything - bmp, jpg, png, etc.
A .png file is a raster image file. In order to convert it to a vector graphic based format like .svg and have it be "native" svg rather than an included image you are going to either have to use a program that can rasterize it or in Inkscape trace the bitmap and turn it into paths. Inkscape provides information on tracing: http://inkscape.org/doc/tracing/tutorial-tracing.html
this question is in close relation to Firefox 3.5 color correction hack?
The situation I have is that there's a canvas game of mine, and the images that are used in it carry additional information about their shape, connection points etc. This information is stored in the PNG image itself, using meaningful colours (eg RGB(255,255,0) for connection point).
Loading element and painting on the canvas creates Image object, img.src is set, and in img.load function I preprocess image data reading the sensitive information (and removing sensitive pixels from the image data before painting to canvas).
The problem: In FF, the pixel which was supposed to be 255,255,0 is actually 255,254,0. I don't have problems with FF color correction (I don't care if the displayed image has right colors, or slightly modified), but I'd expect that getting image data gives me uncorrected data. I'm looking for a solution which would not involve changing images on the server. Is there some way? Eg.
img.setColorProfile(), or
img.disableColorCorrection(), or
img.getImageData(disableColorCorrection) or img.getImageData(colorProfile)?
The problem might have do more with image loading than image drawing.
I think the proper solution is to strip out color profile information from the images (which you seem to want to aovid). If possible server another image resources for Firefox if you cannot need to have the original data intact.
http://f6design.com/journal/2006/12/01/fixing-png-gamma/
Also, you could decode PNG immages in pure Javascript if the server is co-operate and allows CORS and AJAX loading of the images. You decode the image in Javascript using png.js and create a source <canvas> from the image data (instead of <img>). This way it's you in the control what RGB values comes out from each PNG pixel.
https://github.com/devongovett/png.js
In my cocoa application , I need to save each page of the pdf as a jpg .. How can i proceeed using Objective C
Using pure Objective-C (Cocoa and PDF Kit), iterate on the pages of your PDF document, and for each one, create an NSImage whose size is that of the media box of the page, lock focus on it, tell the page to draw, create an NSBitmapImageRep with the focused view (the image), unlock focus on the image, then ask the bitmap image rep for the JPEG data and write that data to the file. (This solution sucks; don't use it.)
Another way is Core Graphics and ImageIO. Create a bitmap context matching the media box and color space of the document, then for each page, create an image destination for the JPEG file, get the page from the document, draw the page in the context, create a CGImage from the context, clear the context using CGContextClearRect, add the image to the destination, and finalize the destination.