Skip to content

Instantly share code, notes, and snippets.

@fbuchinger
fbuchinger / pyexiftool-benchmark.py
Last active November 27, 2019 09:19
Benchmark comparing exiftool, pyexiftool and multiprocessed pyexiftool processing speed.
import os
import timeit
import time
import multiprocessing
import exiftool
metadatadir = r"E:\dev\exiftool.js\test\sampleImages\Acer"
@fbuchinger
fbuchinger / imgtrack.md
Last active August 29, 2015 14:02
mercurial imgtrack extension

Mercurial imgtrack extension

Programmers have been using version control systems for decades to record/log/merge/revert changes in their source code. Photographers don't have a similar tool, although they also have to wrangle with many different versions of one photo:

  1. a photo is typically shot in a Camera RAW format, a kind of digital negative, that needs automatic or manual processing to produce a visible image on the screen
  2. the edited Camera RAW photo has to be saved in another format (e.g. Photoshop PSD or JPEG), because RAW is basically a read-only format. Often multiple versions of one image are saved to test different effects and filters.
  3. then the edited photos are published on photosharing sites or online photo galleries. To increase the upload speed, optimized JPEG versions of the source files are created. The gallery software might create additional versions of the image (e.g. thumbnails and smaller previews).

The problem

This multifile-workflow brings a few problems:

$(document).ready(function () {
var logger = IG.console.getLogger("init");
IG.widgets.init();
IG.switchedToDefaultTab = false;
logger.debug("Setting validators");
$.validator.setDefaults(IG.config.validationOptions || {});
if (IG.config.tabContainer && IG.config.renderTabs) {
IG.IERoundedTabs(IG.config.tabContainer);
}
if (IG.isModalForm()) {}
@fbuchinger
fbuchinger / gist:4001464
Created November 2, 2012 13:46
IG Grid Dependency Data Structure
{
"idfield": "FNAME",
"data": {
"totalrowcount": 726,
"pagesize": 10,
"columns": [{
"name": "FNAME",
"label": "Vorname",
"datatype": "String"
}, {
@fbuchinger
fbuchinger / gist:1501115
Created December 20, 2011 10:33
PhantomJS: Capturing single dom elements as png files
var page = new WebPage(),
address, output, size;
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clipRect) {
var previousClipRect;
if (clipRect) {
if (typeof(clipRect) !== "object") {
@fbuchinger
fbuchinger / gist:1307476
Created October 23, 2011 15:29
datefromarray
dateFromArray = (dateArr) ->
[year, month, day , hour, minute, second, millisecond] = dateArr
(new Date (year, month || 0, day || 0, minute || 0, second || 0, millisecond || 0))
@fbuchinger
fbuchinger / .picasa.ini
Created July 9, 2011 18:26
.picasa.ini decoded
#==============================================================
# .picasa.ini FILE STRUCTURE
#
# reverse-engineered by Franz Buchinger <fbuchinger@gmail.com>
# licensed to the public domain
#
# Picasa Version(s): 3.8.0
#
# Changelog:
# v0.1: initial release
@fbuchinger
fbuchinger / HolidayTagger
Created April 17, 2011 21:53
Mockup Implementation of a HolidayTagger with sample holiday data from the United States. Doesn't yet follow the pictagger api spec. Requires underscore.js
function holidayTagger(date) {
var dateYear = date.getFullYear();
var dateMonth = date.getMonth();
var dateDay = date.getDate();
var getEasterDate = _.memoize(function (year) {
var Y = year;
var C = Math.floor(Y / 100);
var N = Y - 19 * Math.floor(Y / 19);
var K = Math.floor((C - 17) / 25);
var I = C - Math.floor(C / 4) - Math.floor((C - K) / 3) + 19 * N + 15;
@fbuchinger
fbuchinger / DateTime Tagger
Created April 17, 2011 21:51
Mockup implementation of a DateTime Tagger. Requires underscore.js and doesn't yet follow the pictagger.api. Use with care
function dateTagger(date) {
var months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
var weekdays = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
function getWeekOfYear(date) {
a = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 5);
b = new Date(a.getFullYear(), 0, 4);
return ~~ ((a - b) / 864e5 / 7 + 1.5);
}
@fbuchinger
fbuchinger / gist:674212
Created November 12, 2010 15:26
OxJs - jQuery for your Bytes

OxJs - jQuery for your Bytes

OxJs (speak: HexaJs) is a utility library for javascript, that facilitates parsing and creation of binary data in Javascript. While this sounds weird in the first moment, there are a few areas where OxJs can come in handy:

  • If you need to transfer huge amounts of numercial data via AJAX, binary encoding can be much more space-efficient than transfering it in JSON. The number 41239 for example needs 5 Bytes in JSON, but only 2 Bytes in binary encoding (unsigned short). A more practical example is the The Google Maps Polyline Utility, which saves over 80% of the json payload by binary encoding. However, de- and encoding binary information can be a quite tricky and this is were OxJs helps.

  • For client-side file parsing: Recent enhancements in Javascript allow us byte access for to-be-uploaded files. This can be used to perform enhanced sanity che