Skip to content

Instantly share code, notes, and snippets.

View johantiden's full-sized avatar

Johan Tidén johantiden

  • Looklet AB
  • Stockholm, Sweden
View GitHub Profile
@johantiden
johantiden / ImageUtil.java
Created April 7, 2021 06:56
javafx.scene.image.Image safer creation
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.image.Image;
import javafx.scene.image.WritableImage;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
@johantiden
johantiden / PhotoshopMeshReader.java
Last active April 15, 2021 09:03
Showcase of reading a Photoshop liquify .msh file
public static void main(String[] args) throws IOException {
byte[] bytes = Files.readAllBytes(new File("distortedmesh.msh").toPath());
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
byteBuffer.position(64);
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
int HEIGHT = 8;
int WIDTH = 8;