Browse Source

Wrote the man page and changed the behaviour of the get_optimal_size function

master
Jules Roumieux 3 years ago
parent
commit
5229ff105f
2 changed files with 21 additions and 2 deletions
  1. 19
    0
      man/c2m.1
  2. 2
    2
      src/image.c

+ 19
- 0
man/c2m.1 View File

@@ -0,0 +1,19 @@
.TH c2m 1
.SH NAME
c2m \- convert polychromatic images to monochromatic ones, creating an illusion of greyscale
.SH SYNOPSIS
.B c2m
[\fB\-w\fR \fIWIDTH\fR] [\fB\-h\fR \fIHEIGHT\fR]
.IR SOURCE
.IR DEST
.SH DESCRIPTION
.B c2m
is an utility designed to convert polychromatic images to monochromatic ones, in order to display them on a monochromatic display.
It creates greyscales using an optical illusion.
.SH OPTIONS
.TP
.BR \-w " " \fIWIDTH\fR
Sets the width of the destination. If the height is not given, preserve ratio.
.TP
.BR \-h " " \fIHEIGHT\fR
Sets the height of the destination. If the width is not given, preserve ratio.

+ 2
- 2
src/image.c View File

@@ -49,9 +49,9 @@ void write_image(MagickWand * wand, char * filename) {
void get_optimal_size(MagickWand * magick_wand, int * w, int * h) {
int o_h = MagickGetImageHeight(magick_wand), o_w = MagickGetImageWidth(magick_wand);

if((*w)) {
if(!(*h)) {
(*h) = ((*w) * o_h) / o_w;
} else {
} else if (!(*w)) {
(*w) = ((*h) * o_w) / o_h;
}
}

Loading…
Cancel
Save