Automattic/node-canvas

Black CMYK JEPGs in PDF with MIME data mode

Open

#1.183 geöffnet am 21. Juni 2018

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (1.140 Forks)batch import
BugHelp wantedImages & Formats: JPEG

Repository-Metriken

Stars
 (9.524 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 34T 18h) (2 gemergte PRs in 30 T)

Beschreibung

Bug

I want to embed cmyk images in pdf using img.dataMode = Image.MODE_MIME. That should take the image and embed it into pdf without any painting or editing. But all cmyk images are black.

JPG img

PDF

Files img.jpg.zip out.pdf

Related issue https://github.com/Automattic/node-canvas/issues/425

Steps to Reproduce

const { createCanvas, Image } = require("canvas")
const { writeFileSync, readFileSync } = require("fs")

const img = new Image()
img.dataMode = Image.MODE_MIME
img.src = readFileSync("img.jpg")

const canvas = createCanvas(200, 200, "pdf")
const ctx = canvas.getContext("2d")
ctx.drawImage(img, 50, 50, 100, 100)
writeFileSync("out.pdf", canvas.toBuffer())

Your Environment

  • Version of node-canvas: 2.0.0-alpha.12
  • Environment: node 10.1.0, macOS 10.13.5

Contributor Guide