Skip to content

Instantly share code, notes, and snippets.

@rootwork
rootwork / svg-to-pdf-cmyk.md
Last active December 28, 2023 10:15
Creating a 300dpi CMYK PDF from an SVG (on Linux)

Creating a 300dpi CMYK PDF from an SVG (on Linux)

SVGs generated from the web, and any SVGs from Inkscape, will be in the RGB colorspace. To convert it to CMYK for printing, there are basically two major steps: Converting the SVG to a PDF, and then converting the PDF from RGB to CMYK.

Note that CMYK and RGB are literally different types of color; there is not and cannot be a 1:1 correspondence between their colors, so if you need to regularly design for print you should be using CMYK from the beginning (not tacking it on at the end) -- and for that, unfortunately, the only option is Adobe Illustrator.

Anyway, this is what worked for me to convert an RGB SVG to a CMYK PDF with a specific DPI.

Untested options

@bikz05
bikz05 / histogram3D.py
Last active August 20, 2023 14:51
This python script demonstrates how we can use a 3D histogram in OpenCV to sort the colors and find the max color in a image.
# This python script demonstrates how we can use a 3D
# histogram in OpenCV to sort the colors and find the
# max color in a image
import cv2
import numpy as np
# Read the image
image = cv2.imread("/home/bikz05/Desktop/dataset/0.png");
@kergoth
kergoth / trap-set-e-test.sh
Last active June 22, 2023 16:33
Experimental verbose set -e handler for both bash and non-bash cases, with example use of BASH_ARG & BASH_ARGV. I realize enabling extdebug for an exceptional case isn't efficient, but I wanted sane example usage of those variables, so here it is.
#!/bin/sh
. $(dirname "$0")/trap.sh
set -e
foo () {
bar "$@" alpha beta
}