Programmatically setting .eps files to CMYK (as opposed to RGB) - vector

We have an app where we need to export files from vector files from Inkscape to .eps to be used for printing. While this is working fine, our printers have complained that they are receiving the files in RGB mode instead of CMYK.
Is there a way to programmatically set .eps files to CMYK document color mode?

Color mode isn't a setting like, say, DPI. Converting from RGB to CMYK for printing is a complex process, often involving color spaces, halftoning, and other nontrivial algorithms.

Related

Changing the vector file type with inkscape causes the new vector file to have a different size

I am using inkscape to change the file type from a pdf to an emf. I noticed when I open the files in corel (to check that it was outputted correctly) that they are different sizes than each other - the pdf is the size I set it to be initially (as you'd expect), while the emf is a plain letter size (8.5 x 11).
If I am only using
inkscape 49.pdf -o 49.emf
on the command line, why is it changing the document size? Is there a way to preserve it? Has any one else had this problem? I've checked the man page for options and I haven't seen an explicit command to preserve page size (though I don't believe I should have to even do).
Thank you so much for your input!

Saving ggplot plot in R with deeper color depth than PNG-8 format

In R, the default settings to save a PNG file (e.g. ggplot/ggsave) is always the PNG-8 format, which allows up to 256 (2^8) colors. How can I save a image with deep color depth, such as 16/24-bit color? So I can get a "True color' image.
ggplot(mtcars)+ geom_point(aes(x=gear,y=mpg))
ggsave('car.png')
You could use cairographics for that. This should default to a larger format.
install.packages("Cairo")
library(Cairo)
ggsave("car.png", type = "cairo-png")
I don't know of anyway to specify bit depth with ggsave. However, you could use different file types to work around it. ggsave using .tiff files appears to default to 24 bit depth. If your file has to be .png you may be able to convert it after saving as a tiff.
ggsave('car.tiff')

Why does R raster::writeRaster() generate a pic which can't be shown in Win10?

I read my hyperspectral (.raw) file and combine three bands to "gai_out_r" Then I output as following:
writeRaster(gai_out_r,filepath,format="GTiff")
finally I got gai_out_r.tif
But, why Win10 can't display this small tif as the pic that I output the same way from envi--save image as--tif
Two tiffs are displayed by Win10 as following:
Default windows image viewing applications doesn't support Hyperspectral Images-since you are just reading and combining 3 bands from your .raw file, the resulting image will be a hyperspectral image.You need to have separate dedicated softwares to view hypercubes or can view it using spectral-python also.
In sPy, using envi.save_image , will save it as a ENVI type file only. To save it as an rgb image file(readable in windows OS) we need to use other methods.
You are using writeRaster to write to a GTiff (GeoTiff) format file. To write to a standard tif file you can use the tiff method. With writeRaster you could also write to a PNG instead
writeRaster(gai_out_r, "gai.png")
Cause of the issue:
I had a similar issue and recognised that the exported .tif files had a different bit depth than .tif images I could open. The images could not be displayed using common applications, although they were not broken and I could open them in R or QGIS. Hence, the values were coded in a way Windows would not expect.
When you type ?writeRaster() you will find that there are various options when it comes to saving a .tif (or other format) using the raster::writeRaster() function. Click on the links therein to get to the dataType {raster} help site and you'll find there are various integer types to choose from.
Solution (write a Windows-readable GeoTIFF):
I set the following options to make the resulting .tif file readable (note the datatype option):
writeRaster(raster, filename = "/path/to/your/output.tif",
format = "GTiff", datatype = "INT1U")
Note:
I realised your post is from 2 and a half years ago... Anyways, may this answer help others who encounter this problem.

faster download: png or svg?

I was told once that code is faster to download than image files. Is this true, or is file size the only factor that matters?
For example, I have an SVG file that is a complex illustration. This SVG file is 3.5mb, after optimization using SVGOMG.
I also rendered the illustration as a PNG file. The PNG version has file size of only 153k, after optimization using ImageOptim.
In this scenario, is it true that an SVG file download is faster because it is code - as opposed to a bitmap? OR is the file size the only factor that determines download speed?
The reason I am considering SVG is to preserve the detail of the illustration.

R does not show correctly the "NewCenturySchoolbook" font type for PDF output

Why does ggplot2 fail to print out correctly to PDF the NewCenturySchoolbook font type, although it is one of the default font types given in many R examples online.
It works fine for png and svg output files.
EDIT: related problem and solution ggplot embedded fonts in pdf
You may want to double-check that Latex is installed and that it is the default that is used to generate the pdf, and you can add a package to Latex that includes the font.
http://web.eecs.utk.edu/~mgates3/docs/latex-fonts.pdf

Resources