Platform: Linux
Tool: Qrencode (Open source application for creating QR code in linux)
I am using this qrencode application to generate QR code. The output file format that I am using is PNG. But when I try to print the PNG file using dot-matrix printer, it prints correctly but scrolls down whole page i.e. it occupies the whole page, but my requirement is that I should be able to print the image to any point of an page.
Unfortunately I don't have time to go through the entire source code of LIBPNG and QRENCODE.
I strongly recommend to check the man page for lpr
It has an option for positioning the image on the page, e.g. -o position=name.
Check the possible position names in the manual.
Most probably you would need to scale your images.
Be sure that your image is not too large for fitting in the page.
Related
This question is very similar to PDF image in PDF document using ReportLab (Python), but I seem unable to adapt it to my needs:
I want to add vectorized images (available in SVG oder PDF format) to an A4 PDF output. The images must not get scaled! They should simply be placed from top to bottom with some vertical spacing and automatic page breaks.
No text or other content is required. Basically, I'm looking for a pdfnup solution. In the past, I have used pdflatex with a simple input file for the task, but this is no option for the target system.
I am trying to mask the land in a satellite (SAR) grayscale geotiff image. The functionality is available in rsgislib, but it works on Linux and I am working on conda python 3.5 (Windows) and not able to find a possible way out.
Kindly guide as to how the land can be masked out in an image.
I found the way out :
First we have to download an appropriate shapefile of the region we wish to mask,
then there is a beautiful functionality available in gdal called as gdalwarp. We need to just open the anaconda prompt and from there just type in :`
gdalwarp -cutline shapefile_name.shp original_image.tif output_filename.tif
Now, the image with borderlines of the land will get saved in the file output_filename.tif
This is the file which contains the land portion and the ocean is masked out.
Then the procedure becomes fairly simple mask out the land by subtracting the output_filename.tif image from original image.
We will get the image of the ocean part with land portion in black, after that we can make the land portion as NaN.
I would like to render an SVG I've created to a hi-res (600 DPI) PNG. This SVG has filter effects, specifically gaussian blur.
Ideally rendering could be done via the command line.
I know the SVG is renderable because you can open it in Chrome/Chromium and the output I'd like to see is there.
Things I've tried:
Importing to Adobe Illustrator
svg2png
Imagemagick
Inkscape
Other command-line tools and programs I'm forgetting right now. Basically anything you could find with Google.
Current path I'm pursuing but stuck on:
Knowing that Chromium can render the SVG just fine and that it's open-source, I figured I'd download the library Chromium depends on to render SVGs (Skia, https://sites.google.com/site/skiadocs/) and use it to output a PNG. So far I've succeeded in installing Skia and running the very first example. I've found an example that renders an SVG (https://code.google.com/p/skia/source/browse/trunk/samplecode/SampleSVG.cpp?r=875) but haven't successfully run it on my OSX machine with the latest updates to XCode and command-line tools. A modified version of that example (with gyp file) that outputs a PNG would be amazing.
Other ideas that might work:
Getting pixel data from Chrome (how would I do that? A simple screenshot isn't enough because of the resolution of the image. I also want a scriptable, repeatable process.)
Using other graphics library that can render SVG. Maybe this comes from other web browsers, maybe not.
This seems to work nicely:
webkit2png -F blue.svg -o rendered
The -F says to generate the Full resolution PNG and no thumbnails, and the -o specified that the output filename will be rendered-full.png.
I have reduced the size so it fits on Stack Overflow, but the command shown actually gives the full-resolution 2880x2880 image.
I created a pretty nice graph of dependencies in my project by VS2012, the file extension is .dgml
I want to export/convert it to GIF / PNG / JPG / PDF etc.
How can I do this without using print-screen (which forces fit the graph to screen size)?
The graph can't be open by the following:
Image viewer, MS-Word, MS-Paint, Photoshop.
Here is part of the graph:
OK, after some research I found it.
It can be done this way:
Edit -> Copy Image, then paste it in other program.
Note, the current resolution is saved, so zoom to the desired resolution before you do the copy.
I'm using ImageMagick's convert utility to convert SVG file to PNG image. At first, I used vanilla installation of IM on OSX (brew install imagemagick) to convert the SVG using:
$ convert file.svg file.png
This worked except that some of the image objects in that file were offset (actual links to images). I then read a related question that suggested ImageMagick to be compiled with rsvg support (homebrew does it with brew install imagemagick --use-rsvg).
Now, when I try to perform the conversion, no images are rendered. I tried using this SVG file, and the resulting PNG was blank. However, if any text exists on the SVG, it's rendered in the proper location. Any ideas how to proceed? thanks.
You should run this command to see a list of all 'delegates' your ImageMagick is trying to use:
convert -list delegate
To discover which delegate command ImageMagick uses for SVG processing, run
convert -list delegate | grep 'svg ='
You should see the binary + commandline parameters your convert tries to use. Im my case it is /opt/local/bin/rsvg-convert (but I'm not using Homebrew, I use MacPorts).
Now check if the binary is present at all on your system:
If yes, run it directly and debug from there.
If no, try to find where your Homebrew installation installed it, and change ImageMagick's configuration file for its delegates. It's called delegates.xml. MacPorts places it into /opt/local/etc/ImageMagick/delegates.xml -- I don't know where Homebrew stores it.
However, since your un-modified installation was already working, there must have been an SVG consuming delegate at work already then. Otherwise you would not have gotten any SVG processed at all.
This internal SVG rendering method of ImageMagick is called MSVG. This is far from being a feature-complete SVG interpreter/renderer.
Update:
To see what ImageMagick is doing for which format, run this command:
convert -list format
and for SVG run
convert -list format | grep SVG
Output on my system is:
MSVG SVG rw+ ImageMagick's own SVG internal renderer
SVG SVG rw+ Scalable Vector Graphics (RSVG 2.36.1)
SVGZ SVG rw+ Compressed Scalable Vector Graphics (RSVG 2.36.1)
After you installed rsvg, the internal method to render SVGs will not have gone away. You can still force ImageMagick to use the internal renderer by adding MSVG: to the commandline like this:
convert MSVG:file.svg file.png
Just for completeness' sake...
Oh, I now had a look at the SVG file you linked to.
It contains JavaScript. I do not think that the RSVGlib does support JavaScript inside SVGs. I know for sure that the internal SVG coder named MSVG does not.
I had a similar problem and was just told to install inkscape and it works,
ImageMagick converts svg graph into pdf with tilted x-axis labels, any ideas?
The delegate list did not change but the output did. On further fiddling with forced MSVG I could not get the problem to go away. So another delegate is probably the best solution.