notify-send does not show icon, neither as .jpg nor .ico - notify-send

I'm trying to create a notification from a downloaded image:
I tried:
wget -q https://i.ytimg.com/vi/zqKrpw36xnU/maxresdefault.jpg -O/tmp/thumbnail.jpg
notify-send something -i /tmp/thumbnail.jpg
and
wget -q https://i.ytimg.com/vi/zqKrpw36xnU/maxresdefault.jpg -O/tmp/thumbnail.jpg
convert -density 384 -scale 256 /tmp/thumbnail.jpg /tmp/thumbnail.ico
notify-send something -i /tmp/thumbnail.ico
But they both show random previously downloaded image, despite been replaced...
Am I doing something wrong? Is there a better tool than notify-send?
I'm in ubuntu 20.04 with notify-send 0.7.9.

Related

Problem running bash-script in wsl with convert function (ImageMagik) - WSL

A Windows user here, with little, almost zero experience with Linux.
While procrastinating as I wrote my thesis, I encountered a script to convert the pdf to a gif using the command convert from ImageMagik. Here is the result of the gif:
https://raw.githubusercontent.com/npcardoso/PhDThesis/master/thesis.gif
Since I use Windows, I activated WSL and installed Ubuntu.
This is the script I am using:
#!/bin/bash
tmp_dir=$(mktemp -d -t cho-XXXXXXXXXX)
echo $tmp_dir
cd $(dirname $0)
function remove_alpha() {
convert -monitor -alpha remove -background white -antialias $*
}
function to_gif() {
convert -monitor -loop 0 -strip -layers OptimizePlus -delay 50 -antialias $*
}
remove_alpha -density 50 thesis/main.pdf $tmp_dir/thesis_raster.pdf
pdfnup $tmp_dir/thesis_raster.pdf {},1- -o $tmp_dir/thesis_nup.pdf
to_gif $tmp_dir/thesis_nup.pdf thesis.gif
rm -rfv $tmp_dir
However, I am not able to run the script successfully. I get the following errors:
these errors
I do not know how to get rid of these errors. I even tried removing the functions, but I still get the error about the $'.\r': No such file or directory.
errors without the functions
Any guidance?

virt-install is looking for iso image, when I want to use a qcow2 image

I'm absolutely new to stackoverflow, so I'm extremely sorry if my question has formatting issues.
I created a VM using virt-install:
virt-install \
--name guest \
--memory 2048 \
--vcpus 2 \
--disk size=8 \
--location /var/lib/libvirt/images/centos.iso \
--os-variant centos7.0 \
--check disk_size=off \
--graphics none \
--extra-args console=ttyS0
The above command works fine, but when I want to use a specific image which is a qcow2 image, Virt-install throws the error:
ERROR Command '['isoinfo', '-J', '-i', '/var/lib/libvirt/images/centos.qcow2', '-f']' returned non-zero exit status 1
Looks like virt-install is looking for an isofile since its running the isoinfo command to verify an iso image, eventhough I have a qcow2 image.
I might be able to pass a qcow2 using the --disk parameter instead of --location, but --extra-args only works with --location.
Kindly help me out, thank you in advance!
You seem to be mixing up two different concepts here. The --location flag is intended to provide the installation media, which will be an ISO image or a URL to a installable tree. The --disk flag would be to provide the storage to back the virtual disk of the VM being provisioned, which will typically be a qcow2 file or a raw file, or a block device.
I'm assuming the centos.iso image would be your installation media, and the centos.qcow2 image would be an empty volume for the virtual disk into which you'll install the CentOS guest.

ImageMagick Invalid Image Index

A week ago I followed this tutorial, and it successfully worked (even with some changes I did), but today it just won't work.
The edited code is this:
SCREENSHOTFOLDER="/home/pk/screenshots"
FILE="${1}"
FILENAME="${FILE##*/}"
FILEBASE="${FILENAME%.*}"
# drop shadow: 60% opacity, 10 sigma, +0x +10y
convert "${FILE}" \( +clone -background black -shadow 70x15+5+10 \) +swap -background white -layers merge +repage "$SCREENSHOTFOLDER/${FILEBASE}.png"
notify-send -u critical -t 1 "${FILEBASE}.png saved."
xclip -selection clipboard -t image/png -i "$SCREENSHOTFOLDER/${FILEBASE}.png"
that code is run by this script:
escrotum -s -e '/home/pk/ss/dropshadow-c.sh $f'
then, I tried to debug it but when I run escrotum -s -e '/home/pk/ss/dropshadow-c.sh $f' I get this:
convert: invalid image index `2021-04-18-201820_839x396_escrotum.png' # error/list.c/CloneImages/282.
convert: no such image `+clone' # error/convert.c/ConvertImageCommand/1027.
xclip: /home/pk/screenshots/2021-04-18-201820_839x396_escrotum.png: No such file or directory
The problem was that ImageMagick has a bug in the version I used, I downgrade it and it works.

Convert qcow2 to vmdk and make it ESXi 6.0 Compatible

I am currently working on VMWare virtualization; I am trying to make a converted image from qcow2 to vmdk work with ESXi Server 6.0.
I have myImage.qcow2 with a disk which is thin provisioned for 300GB.
I used the image converter tool qemu with the following command
qemu-img convert -f qcow2 myImage.qcow2 -O vmdk myNewImage.vmdk
This command gives me a vmdk image which is only VMWare Workstation compatible. Therefore, in order to make it ESXi compatible I have to use the vmkfstools with the following command.
vmkfstools -i myImage.vmdk outputName.vmdk -d thin
The vmkfstools command gives me two files, an metadata.vmdk and the actual data.vmdk.
As mentioned above my disk is thin provisioned for 300GB and when I apply vmkfstools it expands the disk and gives me a size of 300GB.
Deploying the image through the vSphere Client works without any problem; however, for the purpose of this project I want to use the ovftool and doing so with such a large image is not feasible.
Is there a way for me to make my .vmdk ESXi compatible without vmkfstools expanding my image to 300GB?
Or Is there any other method for me to deploy those 300GB using the ovftool while the disk image is on the datastore, so that it doesn't have to be downloaded/uploaded through the deployment process?
I have been stuck on this for weeks and any help will be highly appreciated.
FYI: This support has been added in Qemu 2.1 and above as per changelogs
qemu-img convert -f qcow2 -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized,compat6 SC-1.qcow2 SC-1.vmdk
This worked for me with VMware 6.7
The TL;DR is
qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized source_qcow_image_path destination_path_to_vmdk
For example:
qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized \
CentOS-7-x86_64-GenericCloud-1503.qcow2 \
CentOS-7-x86_64-GenericCloud-1503.vmdk
Update the vmdk version setting embedded in the converted image using this script:
* This is what actually worked for me *
printf '\x03' | dd conv=notrunc of=<vmdk file name> bs=1 seek=$((0x4))
For example:
printf '\x03' | dd conv=notrunc of=CentOS-7-x86_64-GenericCloud-1503.vmdk bs=1 seek=$((0x4))
source: https://kb.vmware.com/s/article/2144687

Wrong frame rate when saving camera feed to a file using FFMPEG

I'm trying to save the live feed from an IP camera to a file but the resulting file always plays much faster than the original speed.
I have tried with the following commands:
ffmpeg -i http://171.22.3.47/image -vcodec copy -an -t 900 c:\output.mp4
ffmpeg -i http://171.22.3.47/image -c:v libx264 -an c:\output.mp4
Does anybody know what I'm missing? Both commands create the file and I can use Windows Media Player to play them, but they run much faster.
Try forcing output framerate by adding -r key
ffmpeg -i http://171.22.3.47/image -c:v libx264 -an -r 30 c:\output.mp4
You can also try to slow down the resulting video as an option. This will make output.mp4 2 times slower:
ffmpeg -i output.mp4 -filter:v "setpts=2.0*PTS" -c:v libx264 -an output-slow.mp4