@Override
	public void onUpdatePath(@Nonnull PathNode<?> path) {
		if (path instanceof FilePathNode filePath) {
			this.path = filePath;
			FileInfo info = filePath.getValue();
			if (info.isImageFile()) {
				byte[] content = info.getRawContent();

				Image image = null;
				if ("ico".equals(info.getFileExtension()) && ByteHeaderUtil.match(content, ByteHeaderUtil.ICO)) {
					// JavaFX doesn't directly support ICO files, so we need to adapt it.
					try {
						image = Icons.convertIcoToFxImage(content);
						if (image == null) {
							logger.error("Failed to decode ICO image, no bundled images in file");
							setDisable(true);
						}
					} catch (IOException ex) {
						logger.error("Failed to decode ICO image", ex);
						setDisable(true);
					}
				} else {
					image = new Image(new ByteArrayInputStream(content));
				}

				// Update the image view and change the initial translation sizes so that it appears centered.
				if (image != null) {
					imageView.setImage(image);

					// Note: The height property is updated after the width, so when we see the
					// height become a non-zero value we know we can compute the proper translations
					// to center the image.
					Image ref = image;
					NodeEvents.dispatchAndRemoveIf(imagePanner.heightProperty(), (ob, old, cur) -> {
						if (cur.intValue() > 0) {
							double wp = imagePanner.getWidth() / 2;
							double hp = imagePanner.getHeight() / 2;

							double wc = ref.getWidth() / 2;
							double hc = ref.getHeight() / 2;

							double x = wp - wc;
							double y = hp - hc;

							imagePanner.setInitTranslation(x, y);
							return true;
						}
						return false;
					});
				}
			}
		}
	}
Displays a {@link ImageFileInfo} in a pannable view, with some extra utility.

@author Matt Coley
recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/image/ImagePane.java