Skip to content

Instantly share code, notes, and snippets.

View senyai's full-sized avatar
💭
preferring fossil to git

Arseniy Terekhin senyai

💭
preferring fossil to git
View GitHub Profile
// based on https://stackoverflow.com/questions/1997661/unique-object-identifier-in-javascript
const getID = (function() { // FOR DEBUG ONLY. DO NOT COMMIT!
var id = 0;
return function(o: any): number {
if ( typeof o.__uniqueid != "undefined" ) {
return o.__uniqueid;
}
Object.defineProperty(o, "__uniqueid", {
@senyai
senyai / assign_icc.py
Created September 13, 2019 11:11
Save numpy array with icc profile
from PIL import Image
import numpy as np
def main():
arr = np.asarray([[0,0,0],[0,255,0],[0,0,0]], dtype=np.uint8)
img = Image.fromarray(arr)
with open('ITU-R_BT2020(beta).icc', 'rb') as f:
img.info['icc_profile'] = 'f.read()'
img.save('path.png')
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.24215.1
TITLE c:\users\senyai\documents\visual studio 2015\projects\cpp_test_2016\cpp_test_2016\cpp_test_2016.cpp
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB OLDNAMES