• Stars
    star
    218
  • Rank 181,805 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Javascript library that allows you to change an image's DPI settings in the browser

changeDPI

changeDPI provides 2 utility functions that can change the dpi of canvas-generated image, of either dataUrl or blob formats. The functions separate the header from the image data, convert and manipulate just the header, then sticks the header back on the file. In this way, very large images can be converted quickly without having to convert the entire contents of an image file. This process is non-destructive—image data does not get modified in the process.

Install

This project depends on node and npm.

npm install --save changedpi

Usage

From a canvas element dataUrl:

// create the dataUrl at standard 72dpi
var dataUrl = canvas.toDataURL('image/jpeg', 0.92);
var daurl150dpi = changeDpiDataUrl(dataUrl, 150);

From a canvas element blob:

// create the blob at standard 72dpi
canvas.toBlob(function(blob) {
  changeDpiBlob(blob, 300).then(function(blob){
    // use your changed blob
  })
},'image/jpeg', 0.92);
  TODO add example with file reader.

ES6

This module uses ES6. To see a compiled ES5 version, run npm run build and look in dist/.

Testing

npm install .
npm run test

Contribute

Please do contribute! Open an issue or submit a pull request.

The project falls under @Shutterstock's Code of Conduct.

License

MIT.

More Repositories

1

rickshaw

JavaScript toolkit for creating interactive real-time graphs
JavaScript
6,531
star
2

node-common-errors

Common error classes and utility functions
JavaScript
285
star
3

lil-brother

Track clicks and other client-side events on web pages
JavaScript
225
star
4

ntf

Network Testing Framework
JavaScript
98
star
5

basecoat

A small, fast, static free micro framework that makes no assumptions and requires no conventions. It is well suited for migrating off legacy code, building services, or complex websites.
PHP
42
star
6

shutterstock-heatmap-toolkit

Shutterstock's interactive heatmap toolkit powered by heatmap.js and Solr
JavaScript
36
star
7

api-clients-examples

Shutterstock API Clients and Examples
33
star
8

armrest

A high-level HTTP / REST client for Node
JavaScript
29
star
9

gremlin-aws-sigv4

Extension for Apache's TinkerPop3 Gremlin JS driver compatible with IAM Database Authentication for Neptune
JavaScript
29
star
10

fnFlow

Pronounced "effin' flow" because it's so badass, fnFlow is a Javascript control flow library heavily influenced by Caolan McMahon's async that encourages a proper functional design pattern.
JavaScript
21
star
11

opentree

Generate an Org Chart from Workday
Java
19
star
12

postcss-copy-assets

PostCSS plugin to copy assets referenced by relative url()s into a build directory.
JavaScript
18
star
13

node-procedural-async

Write procedural style code that runs asynchronously. It may look synchronous, but it's not!
JavaScript
17
star
14

public-api-javascript-sdk

Simplify and speed up integration by using a JavaScript library to access our API.
JavaScript
17
star
15

UrlManager

Javascript class for getting and setting url parameters
JavaScript
15
star
16

tungsten-replicator

Shutterstock git mirror of Tungsten Replicator.
Java
14
star
17

juxtaposer

Screen shot capture and comparison tool for testing website changes.
JavaScript
14
star
18

kafkajs-async-retry

Provides a KafkaJS-compatible handler for processing messages that facilitates publishing to delayed-retry or dead-letter topics
TypeScript
14
star
19

terraform-aws-s3-squid-proxy-farm

AWS Terraform module to create an S3 Squid proxy farm on AWS
HCL
12
star
20

ntfserver

Network Testing Framework Server
JavaScript
11
star
21

task

Task-based git release management
Perl
10
star
22

node-shutterstock-api

⛔️ DEPRECATED - A client for the Shutterstock API written in Node
JavaScript
9
star
23

presto

PHP REST Orchestration
PHP
8
star
24

welcome

Welcome to the Shutterstock Community
7
star
25

ruby-shutterstock-api

⛔️ DEPRECATED - Ruby client for Shutterstock public API
Ruby
7
star
26

node-favicon-video

Videos in your favicon!
JavaScript
7
star
27

php-shutterstock-api

PHP Client to interact with the Shutterstock API
PHP
7
star
28

orc-metadata-reader

Python ORC metadata reader
C
7
star
29

Data-Partial-Google

Filter data structures for "partial responses," Google style
Perl
6
star
30

shutterstock-cli

A command-line utility that allows you to interact with the Shutterstock public API.
Python
6
star
31

devent-router

Route Devent messages by topic
C
5
star
32

oplog

An operations log
JavaScript
5
star
33

SVC

MVC for javascript with the observer pattern
JavaScript
5
star
34

node-timing-middleware

Expose request timing in express apps
JavaScript
5
star
35

public-api-sdk-generator

Mustache
4
star
36

shutterstock-oauth-sample

⛔️ DEPRECATED - Shutterstock Oauth Sample code, for interacting with the Shutterstock API
JavaScript
4
star
37

devent-forwarder

Forward Devent messages via HTTP, UDP or ZMQ
JavaScript
4
star
38

spark-phrases

phrase detection using Google's Word2phrase
Scala
4
star
39

php-shutterstock-api-example

Example PHP application that interfaces with Shutterstock API
PHP
3
star
40

node-icu-numformat

Node.JS bindings to libicu number formatting functions
C++
3
star
41

MogileFS-Plugin-Migrate

MogileFS plugin for moving files across domains
Perl
3
star
42

astore

Shared request aggregator and temp entity store
JavaScript
3
star
43

gitbook-plugin-related-links

Gitbook plugin that collects and shows related links
JavaScript
3
star
44

go-stockutil

A collection of various useful utility functions for Golang applications
Go
3
star
45

wordpress-plugin

PHP
2
star
46

Stemming-Exceptions

A collection of stemming exceptions for different languages.
2
star
47

perl-moosex-role-rest-consumer

Perl
2
star
48

Net-Statsd-Client

Perl
2
star
49

newrelic-console-logging

Forwards all logs emitted through console.log (and friends) to New Relic's application logging aggregation endpoint.
JavaScript
2
star
50

a-swig-service

A service that well, serves html from swig templates
JavaScript
2
star
51

ntfd

Network Testing Framework Daemon
JavaScript
2
star
52

Webdam-Wordpress-Asset-Chooser

Webdam Wordpress Asset Chooser Plugin
PHP
2
star
53

bigstock-php-client

⛔️ DEPRECATED - PHP Client for the Bigstock API
PHP
2
star
54

api-php-client

⛔️ DEPRECATED - Sample PHP client implementation of Shutterstock API
PHP
2
star
55

p-map-iterable

Performs a concurrent mapping with back pressure (won't iterate all source items if the consumer is not reading).
TypeScript
2
star
56

bigstock-ruby-client

⛔️ DEPRECATED - A Ruby client for Bigstock's API
Ruby
1
star
57

bristlecone

A set of test tools that perform useful services for measuring database and database cluster performance
Java
1
star
58

perl-devent-client

Perl client for writing Devent messages
Perl
1
star
59

chunker

Calls a callback when size would be exceeded or count is met
TypeScript
1
star
60

aws-embedded-metrics-flatten

Helper for aws-embedded-metrics npm module - Optionally disable emitting metrics and consolidate / flatten thousands of increments on Count metrics into a single line per run.
JavaScript
1
star
61

kinesis-helpers

Helpers for @aws-sdk/client-kinesis
TypeScript
1
star
62

homebrew-shutterstock

Homebrew tap for Shutterstock
Ruby
1
star
63

shutterstock-ui-wizard

HTML
1
star
64

shutterstock-js-cli

Shutterstock in your /usr/bin
JavaScript
1
star
65

http-close-channel

Express middleware for managing and closing HTTP channels
JavaScript
1
star
66

mold

JavaScript
1
star
67

node-debug-middleware

Log all middleware that is slow to respond
JavaScript
1
star
68

perl-webservice-swigclient

A fast client for swig.io
Perl
1
star
69

perl-db-transaction

feather-weight transaction management for your DBI handles
Perl
1
star
70

vertica-cli

Command-line Vertica client in Node.js
JavaScript
1
star
71

WebService-Shutterstock

⛔️ DEPRECATED - Easy access to Shutterstock's public API
Perl
1
star
72

bigstock-node-client

⛔️ DEPRECATED - A node.js client to use with Bigstock, an easy-to-use marketplace for stock images.
JavaScript
1
star
73

Tree-SEMETrie

Single-Edge-Multi-Edge Trie
Perl
1
star