Coder Social home page Coder Social logo

jpgcompressor's Introduction

Titanium JPGCompressor

Author: Philipp Fehre Website Repository: https://github.com/sideshowcoder/jpgcompressor

Description

Compression

Passing through UIImageJPEGRepresentation option to compress and scale images passed as a TiBlob. The resulting image is write to e temporary file if the name is passed as a secound argument or passed back as a TiBlob if no name is given.

The compression quality is calculated by check the received data size against the desired size the ratio is taken as the compression factor. If wortQuality limit is set it is the take as the compression factor if the ratio calculated drops below.

Example

100kb Image desired 50kb compressed -> compression factor 0.5 100kb Image desired 50kb compressed, worst quality set to 0.6 -> compression factor 0.6

Scaling

Scale images using UIGraphicsBeginImageContext to fit the image in the desired size

Usage

See example/app.js and https://github.com/sideshowcoder/jpgcompressor/blob/master/documentation/index.md

Testing

Run the example app and follow it's log see example/app.js for more details

Setup

Install the CLI tools via npm install appcelerator -g and install the needed sdk after by running appc setup and titanium sdk install 3.5.0.GA. Now you can build the module by going into the folder and run python build.py.

NOTE: Depending on your python setup it might complain about missing markdown This can be solved by running sudo easy_install markdown

jpgcompressor's People

Contributors

sideshowcoder avatar rborn avatar

Stargazers

Rokyugen avatar  avatar shellyhh avatar  avatar Manaday Mavani avatar xiyunlong avatar Emil Zak avatar  avatar Chetan Jadhav avatar Romeo Manzur avatar Danish A. Ansari avatar Digitalico avatar Steven avatar Adrian avatar Shashi Jain avatar Masahiro Ueno avatar Andrew Church avatar Andreas Pollak avatar José Carlos Andreu avatar Rafique avatar David Knell avatar Atsushi Kataoka avatar samuele coppede avatar Michael Roling avatar  avatar Christian Sullivan avatar  avatar Garrett Wilson avatar Ahmed Abu Eldahab avatar Koichi Yamamoto avatar Jeremie Weldin avatar Shin Morichika avatar José Padilla avatar zheng avatar

Watchers

Jae Lee avatar freemember007 avatar James Cloos avatar  avatar  avatar

jpgcompressor's Issues

No EXIF data

Is it normal that when you compress a picture, the EXIF data has gone? It's a bit problematic because of the Orientation tag that is mandatory in order to display a picture correctly.

Build Failed

I'm assuming the module must be built before being used, unless there is a precompiled version somewhere that I am not seeing??

When I attempt to build the module in Titanium, I'm getting the following error:

Traceback (most recent call last):
  File "/Users/allenhartwig/Downloads/sideshowcoder-jpgcompressor-fd04563/build.py", line 191, in <module>
    compile_js(manifest,config)
  File "/Users/allenhartwig/Downloads/sideshowcoder-jpgcompressor-fd04563/build.py", line 69, in compile_js
    from compiler import Compiler
ImportError: cannot import name Compiler

64bit

Could you be so kind to update this module to 64bit architecture?

Build Failure on Device

Hi, this works extremely well on the simulator, so I'm hoping to fix it on the local device. I've added:

com.sideshowcoder.jpgcompressor

to my tiapp.xml but continue to get this error when I try to build for testing on an iPhone 4 (iOS 5.0):

[ERROR]
[ERROR] Error: Traceback (most recent call last):
File "/Users/mfogg/Library/Application Support/Titanium/mobilesdk/osx/2.0.2.GA/iphone/builder.py", line 1465, in main
execute_xcode("iphoneos%s" % iphone_version,args,False)
File "/Users/mfogg/Library/Application Support/Titanium/mobilesdk/osx/2.0.2.GA/iphone/builder.py", line 1224, in execute_xcode
output = run.run(args,False,False,o)
File "/Users/mfogg/Library/Application Support/Titanium/mobilesdk/osx/2.0.2.GA/iphone/run.py", line 41, in run
sys.exit(rc)
SystemExit: 65

The odd part is, when I erase that line from the tiapp.xml the project builds fine and installs on the phone correctly (although, obviously it complains that the module is missing). Any idea what the issue may be?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.