How can I apply an alpha mask image in TransLoadIt? - image-masking

Using ImageMagick on the command line I can use the composite and compose options to use one image to replace the alpha mask of another image. Is this possible using transloadit ? I see an option to add a watermark but nothing related to replacing the alpha channel.

That's currently not possible. I'm a Transloadit cofounder though and if you can email us about your usecase, timeframe, and expected volume, we might be able to implement this for you.

Related

displaying tables with a telegram bot?

I'm going to need to display a list of results as a response from a telegram bot I'm working on, and was wondering what's the best way of doing that...
I could "calculate" the amount of spaces I need to make it look semi-normal, but I'd rather have a better solution, if there is one.
Thanks!
So, the closest solution I could find is using "pre" inside the bot message (assuming it has parseMode=html), since the characters are all the same width.
I won't be using it eventually, but that's my 2 cents..
i prefer generating HTML table as file and then convert it to an image with some tools, and finally send the image to user by sendPhoto method.
by this method i can create a beautiful colored table with many options...
I have used a PHP library to generate a tabular structure, then used <pre> tag to keep the spacing as it is as suggested by trueicecold

How to use crossfilter with sigma.js and canvas

I'm really not sure how to get started trying to use crossfilter to change my network visualisation (generated using sigma.js - which uses canvas to draw the visualisation). I'm relatively new to js.
Basically I want the size of my nodes to reflect values tied to dates which I want to filter using crossfilter.
Is this possible?
Any help would be much appreciated.
You could use linkurious.js (a fork of sigma) and it's filter plugin. Here's a demo: https://rawgit.com/Linkurious/linkurious.js/develop/examples/filters.html

How to do chalk style drawing with Qt

I want to use Qt to draw lines in chalk style, as you typically see on a blackboard. Here is an example of what I have in mind:
What is the best way to achieve this rendering style? Do I need to draw a lot of little lines with a special brush, or is there a better way to get the "curvy" style you see in the sample image?
And where is the best place to integrate this? Theoretically it would be ideal to get this underneath QPainter, e.g. in a custom QPaintEngine, so that e.g. all the various QPainter::drawLine calls end up using the chalk style. However, it seems while the QPaintEngine interface looks perfect for this, the class itself isn't meant to be used for this purpose...
Thanks in advance for any help.
Greetings,
Fabian
I have solved the problem in a different way. Using textured brushes didn't provide good results (maybe my fault). QGraphicsEffect was unfortunately not an option since my rendering is not based on QGraphicsView.
What I have done in the end:
Derived an own class from QPainter (i.e. ChalkPainter)
Added a new drawChalkLine() method to ChalkPainter. This method takes the passed line, splits it into smaller chunks and renders these chunks as bezier curves via QPainter::drawPath. For each bezier curve chunk I randomly shift the control point orthogonal to the line.
Next I added additional rendering methods to the ChalkPainter class, such as drawChalkRect(), all internally using the drawChalkLine() method.
This is not the most elegant method since I can't use the QPainter methods directly, but it provides good results for my purpose. Here is an example:
I would start looking in QGraphicsEffect's way.. I think it should be possible to develop such a filter which will produce similar effect..
I'll update in here answer on your comment.
No, QGraphicsEffect can be applied 'per graphics item'. If you have a look on QGraphicsItem you will see that there is a setGraphicsEffect method, so you can design an effect which works on QGraphicsLineItem for example and set it only on lines you want to look chalky..
Important thing is that you don't have to operate on pre-drawn image, you can either make it completely owner-draw item with graphicsEffect (for example make an assumption that effect is only applicable on QGraphicsLineItem) pre-draw it using drawSource() and then modify OR draw it completely from scratch..
I would love to help you with some coding, probably will do it somewhere around next week, since I will need similar thing for project I am working on now.. but physically don't have time next few days..
I'll update an answer with sources link as soon as it's done.
Custom brush also looks really promising..

How to Add assertion in monkey runner

I need to add couple of assertions on the screen.
Lets Say I am on Page 1. I need to verify that some xxx text is displayed or not and button is displayed or not and also need to verify that the label of the button.
Please Help me how to add assertion in the monkey runner script..
Thanks
AFAIK Monkeyrunner doesn't have its own assertion mechanisms that would suit your need.
You can take a snapshot of your device and use some external image processing mechanism to verify interesting parts - but I know that wouldn't be ideal for text comparison.
You can use Python Imaging Library http://www.pythonware.com/products/pil/
Take a look at http://developer.android.com/guide/developing/tools/MonkeyImage.html, if you already have a MonkeyImage object that looks correct you can use MonkeyImage.sameAs() to compare it to the current MonkeyImage.
http://docs.python.org/library/pickle.html might be helpful for saving MonkeyImage objects. (I'd like to stress the might though)
The next version of the SDK should have a method of loading MonkeyImage objects from image files so you can compare it with less work. See https://review.source.android.com//#change,21478 for more info about this change.

Command line utility: how to make it right?

I have several question:
If there is an error which has to be displayed to the client - It is a good thing to use STDERR stream instead of STDOUT? Or is it a trivial issue?
I want to add color support to output messages of this utility. Do I have to use some environment-tolerant framework for that?(it can be 256 color mode and "pure" one). Or how to make it tolerant?
I'm afraid to add colors to the output because clients may redirect output to log file. Can it potentially "break" anything because of that?
Please help me to build this utility in UNIX-way(Do one thing and do it well).
STDERR is better than STDOUT for errors for a couple of reasons. Redirecting the output won't hide the errors from you. You can prevent warnings from mixing with the output which makes it easier to parse/process in some cases.
You may want to look into the curses library which should support the ANSI color sets.
Utilities like ls will detect if their output is being redirected and drop the color codes so that log files, etc. don't get horked up. You should do the same.
Use STDERR. As for the colors, your concern can be alleviated by checking if the output is a tty before printing colors to it. During initialization, have a check that enables or disables colors on the fly. It's also good practice to have a --color=[on|off|auto] flag that a user can pass to select one explicitly.

Resources