-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: width
argument to calculate scale from number of available columns
#6
Conversation
Will calculate scaling based on parameter-specified columns number.
Nice feature @giulio-Joshi, I Think it will be useful ❤️ |
I'm glad you liked the tool, And thanks to you for tests |
/// Determine how much scale to use in presence of `width` parameters, | ||
/// otherwise returns regular `scale` parameter per default behaviour | ||
/// | ||
fn calculate_scale(args: &Arguments, dimensions: (u32, u32)) -> u32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make this method as inline method using the #[inline]
suggests, This will can provide small but easy speed win.
https://nnethercote.github.io/perf-book/inlining.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, even if actually is called just once per run.
Could gain more performance if we read the image from a file, or from stdin
(for better bash integration).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand reading the image from a file, but what you mean with reading it from stdin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would mean like how the -@
options works for zip
program:
ls *.jpg | zip image_gallery.zip -@
All *.jpg
files get streamed to zip
and each one gets added to image_gallery.zip
But that would mean changing some of the program parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition thanks, but there are some minor tweaks
* Documentation consistency * Method inlining
Yes of course, changes incoming. |
Hello, its me again 😃
I'm using your converter and found myself in this situation: I wanted to
aartyze
a bunch of pics from different size, all to an ascii file the same width.This feature come out naturally and gave the occasion of testing a small part of the code.
Do you think this could help you?