Showing posts with label virtualization. Show all posts
Showing posts with label virtualization. Show all posts

Friday, November 22, 2024

Brighten an \includeimage image in LaTeX Using decodearray without modifying the file

You can adjust the brightness of \includegraphics images in LaTeX without editing them!

The decodearray option in the graphicx package allows you to modify the appearance of images directly within your document.
This is especially useful if you need to tweak image brightness directly in your document without relying on external image editing tools.
The decodearray feature relies on PDF features supported by modern LaTeX engines  such as LuaLaTeX or XeLaTeX. 

\documentclass{article}
\usepackage{graphicx}
\begin{document}

% Original RGB image
\section*{Original Image}
\includegraphics[width=0.5\textwidth]{example-image.jpg}

% Brightened image using decodearray
\section*{Brightened RGB Image}
\includegraphics[width=0.5\textwidth, decodearray={0.2 0.5   0.2 0.5   0.2 0.5}]{uiskentuie_standing_stone.png}


\end{document}


In the example decodearray={0.2 0.5    0.2 0.5    0.2 0.5} maps the original range [0, 1] for each one of the three RGB channels to a narrower, brighter range [0.2, 0.5].

source: https://tex.stackexchange.com/questions/29227/can-includegraphics-be-used-to-change-an-image-color/150219#150219


Sunday, March 3, 2019

Run a dockerized jupyter notebook (with GPU)

Launch the docker container (running a jupyter notebook with unprivileged an user).
This command maps the port 8888 of the container to the port 9999 of the host, mounts the directory /home/foo/docker to /home/foo in the container     
$ docker run --rm -p 9999:8888           \
         -v /home/foo/docker:/home/foo   \
         -it jupyter/tensorflow-notebook \
         jupyter notebook --port=8888
Using the nvidia-docker driver it is possible to assign a GPU to the container:
NV_GPU=1 nvidia-docker run --rm -p 9999:8888 \
         -v /home/foo/docker:/home/foo         \
         -it jupyter/tensorflow-notebook       \
         jupyter notebook --port=8888

To connect as root to a live container for maintenance use the command below. Suppose that the running container ID (from docker ps) is 4f177e045de6,  then call
docker exec -ti 4f177e045de6 --user=root bash

Docker containers with NVIDIA GPUs using nvidia-docker


nvidia-gpu-docker

These are the installation instructions for Ubuntu:



Test the installation running
$ docker run --runtime=nvidia --rm nvidia/cuda:latest nvidia-smi
 or the equivalent nvidia-docker wrapper call
$ nvidia-docker run --rm nvidia/cuda:latest nvidia-smi

The wrapper allows to easily select which of the host's GPUs are visible from the docker instance, in this example only the first two GPUs
$ NV_GPU=0,1 nvidia-docker run --rm -v /home/foo/data:/data -it nvidia/cuda:latest bash