How can I save a base64-encoded image to disk?

My Express app is receiving a base64-encoded PNG from the browser (generated from canvas with toDataURL() ) and writing it to a file. But the file isn’t a valid image file, and the “file” utility simply identifies it as “data”. var body = req.rawBody, base64Data = body.replace(/^data:image\/png;base64,/,””), binaryData = new Buffer(base64Data, ‘base64’).toString(‘binary’); require(“fs”).writeFile(“out.png”, binaryData, “binary”, … Read more

How do you stretch an image to fill a while keeping the image’s aspect-ratio?

I need to make this image stretch to the maximum size possible without overflowing it’s <div> or skewing the image. I can’t predict the aspect-ratio of the image, so there’s no way to know whether to use: <img src=”https://stackoverflow.com/questions/1891857/url” style=”width: 100%;”> or <img src=”https://stackoverflow.com/questions/1891857/url” style=”height: 100%;”> I can’t use both (i.e. style=”width: 100%; height: 100%;”) … Read more

How can I convert a series of images to a PDF from the command line on linux? [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 10 years ago. Improve this question I have a scanning server I wrote in cgi/bash and want to be able to convert a bunch of images (all in one … Read more

How do I force Kubernetes to re-pull an image?

I have the following replication controller in Kubernetes on GKE: apiVersion: v1 kind: ReplicationController metadata: name: myapp labels: app: myapp spec: replicas: 2 selector: app: myapp deployment: initial template: metadata: labels: app: myapp deployment: initial spec: containers: – name: myapp image: myregistry.com/myapp:5c3dda6b ports: – containerPort: 80 imagePullPolicy: Always imagePullSecrets: – name: myregistry.com-registry-key Now, if I … Read more

CSS3 Rotate Animation

<img class=”image” src=”” alt=”” width=”120″ height=”120″> Cannot get this animated image to work, it is supposed to do a 360 degrees rotation. I guess something’s wrong with the CSS below, as it just stays still. .image { float: left; margin: 0 auto; position: absolute; top: 50%; left: 50%; width: 120px; height: 120px; margin-top: -60px; margin-left: … Read more