Skip to content

Instantly share code, notes, and snippets.

@jindili
jindili / loadUrl.jsx
Created August 2, 2023 12:10 — forked from mericson/loadUrl.jsx
Loads data from a URL in Adobe Illustrator! (Uses Bridge behind the scenes)
var doc = app.activeDocument;
var docPath = doc.path;
function loadUrl(url, callback) {
var bt = new BridgeTalk();
bt.target = 'bridge' ;
@jindili
jindili / scratch_3_text.css
Created November 25, 2022 11:18 — forked from lyshie/scratch_3_text.css
放大 Scratch 3 字型 (Enlarge font size in Scratch 3)
/*
1. Install Stylus (https://chrome.google.com/webstore/detail/stylus/clngdbkpkpeebahjckkjfobafhncgmne)
2. URL: Regular expression (https://scratch.mit.edu/projects/.*editor.*)
*/
/*
* {
font-family: "微軟正黑體" !important;
}
*/
@jindili
jindili / Toggle_SubstanceDesigner_WindowMaximize.ahk
Last active October 14, 2022 06:10
Toggle Adobe Substance Designer Window Maximize and Restore Using Autohotkey and UIAutomation
#include <UIA_Interface>
#IfWinActive ahk_exe Adobe Substance 3D Designer.exe
Space::
UIA := UIA_Interface() ; Initialize UIA interface
el := WinExist("ahk_exe Adobe Substance 3D Designer.exe")
el := UIA.ElementFromHandle(el)
if (el.FindFirstBy("FullDescription='Restore window'"))
{
@jindili
jindili / set_LabColor_input.jsx
Created July 26, 2022 09:35
Photoshop input accurate LAB Color
#target photoshop;
var value = prompt("Type in the Color value in LAB", "L,A,B");
var colour = new SolidColor();
values = value.split(',')
colour.lab.l=values[0];
colour.lab.a=values[1];
colour.lab.b=values[2];
app.foregroundColor=colour;
; Accessible Info Viewer by jethrow
; https://autohotkey.com/board/topic/77888-accessible-info-viewer-alpha-release-2012-09-20/
; Modified by tmplinshi - https://gist.github.com/tmplinshi/0fcb8655c1402a3662ac048d0d974915/
#NoEnv
#SingleInstance, force
SetBatchLines, -1
{
WM_ACTIVATE := 0x06
@jindili
jindili / Canvas_contourDetection.js
Last active June 7, 2023 01:51 — forked from sasekazu/gist:bac785784e17e625a724
HTML5 canvas 画像処理 輪郭追跡 Freeman chain code
// 輪郭追跡を行い,輪郭部のみに色を出力する
function contourDetection(contextIn, contextOut, width, height) {
var imgData=contextIn.getImageData(0, 0, width, height);
// 読み取り用ピクセルデータ(書き換えない)
var pixelData = new Array(width);
for(var i=0; i<width; ++i) {
pixelData[i] = new Array(height);
for(var j=0; j<height; ++j) {
pixelData[i][j] = imgData.data[4*(width*j+i)];
}
@jindili
jindili / gist:4c120ca526452f24a5b108c71235507b
Created June 14, 2021 11:19 — forked from sasekazu/gist:ca74de14c92d48acfe91
HTML5 canvas 画像処理 二値化
// 二値化
// canvasコンテキスト contextIn を閾値 threshold の元で二値化して contextOut に書き出す
// 入力画像はグレースケール画像であることを想定している(RGB値がすべて同じ)
// アルファ値が 0 のピクセルは閾値に関わらず白にする
function binarization(contextIn, contextOut, width, height, threshold) {
var imgData = contextIn.getImageData(0, 0, width, height);
var gray;
for(var i=0; i<imgData.width*imgData.height; ++i) {
if(imgData.data[4*i+3]==0) {
imgData.data[4*i] = 255;
@jindili
jindili / gist:fc5be5fb9a389254f05561a27c046ef1
Created June 14, 2021 11:19 — forked from sasekazu/gist:2faafd364daa849d937f
HTML5 canvas 画像処理 グレースケール化
// グレースケール化
// canvasコンテキスト contextIn をグレースケール化して contextOut に書き出す
// ただしアルファ値が 0 のピクセルはそのままにする
function grayScale(contextIn, contextOut, width, height) {
var imgData = contextIn.getImageData(0, 0, width, height);
var gray;
for(var i=0; i<imgData.width*imgData.height; ++i) {
if(imgData.data[4*i+3]!=0) {
gray = 0.299*imgData.data[4*i]+0.587*imgData.data[4*i+1]+0.114*imgData.data[4*i+2];
gray = Math.floor(gray);
@jindili
jindili / gist:71c0c3abcae70a67079cdec0764b17f6
Created October 23, 2017 17:15 — forked from Jondeen/gist:9e52c21f20c48aa649d6
Vips and crossing numbers binary implementation
#!/usr/bin/python
from gi.repository import Vips
import sys
#Original points:
pts=[[100,100],[200,200],[300,100],[400,300],[300,400],[200,300],[100,100]]
im=Vips.Image.new_from_file("image_to_be_masked.v")
#Extremas:
min=[pts[0][0],pts[0][1]]
@jindili
jindili / dominant.py
Created October 21, 2017 09:08 — forked from jcupitt/dominant.py
find dominant colour
#!/usr/bin/python
import sys
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
im = Vips.Image.new_from_file(sys.argv[1], access = Vips.Access.SEQUENTIAL)