Package: saenews
For Quickstart goInstalling PythonThe package runs on python3 (3.5+). It is recomended to use anaconda if you are on Windows or Ubuntu. Anaconda is a package distributer. It creates "Virtual Environments" and hence safer as it does not alter the core Python installation of the system. Miniconda, as the name says, is a minimal version of anaconda. If you are not a regular user of python use Miniconda.Installing MinicondaDownload the relevant version (Windows, Linux or Mac, 64 or 32 bit)For Windows : Execute the .exe file.For Linux :Download the fileGo to the folder you had downloadedOpen the terminalInstall it with the commandsh <the file name>.sh(Should look something likesh Miniconda3-latest-Linux-x86_64.sh)Accept the Terms and ConditionsIn the final step when the command asks if you want to initialize. PressYoryes(By default it will beno). This will prevent you from reinitializing the Miniconda everytime you boot up.Exit the terminal and open it again (Or you can give the commandsource ~/.bashrc.)Installing Image editing libraryFor Windows : Open the Anaconda Prompt.For Linux : Open TerminalInstall the package usingpip.pipis a package installer (Kind of Software installer you can say). It will download the version that is compatible with your computer and installs it. Essentially it automates the installation process. The user need not care about the manual installation.Use the specific version number to get the particular version of the packagepip install saenews==<version_number>As of now the latest version is1.2.0so usepip install saenews==1.2.0(installation may take 5-10 mins)Editing ImagesOnce the package is installed you can use the package to edit images. (You need the image, obviously).With the package you can do the following edits.Adding Logo, twitter, facebook handles etc.Adding borderAdding QuotesAdding focus (Shading out unimportant regions, also known as vignette effect)Automatically focus on face.Add Title.Add Tagline.And moreover, if you haveNimages you can just repeatedely do the work with just one additionalforloop.Importing LibraryFirst go to the directory wher you have the image that you want to edit. Then open Python with the commandpython. On Windows you need to do this on the Anaconda Command prompt. On Linux use the terminal.pythonCheck of the package is installed properly. To do this import the library usingimportsaenewsfromsaenews.utilsimportquote,put_quote(The second command checks if the functions are imported or not)Putting Twitter and Facebook handlesFor namesake I am considering the image name to beimage.jpg. But change it accordingly.fromsaenews.utilsimportquote,put_quoteput_quote('image.jpg')The final image would be saved in the directory in the format "Current Date and time".png . It will also be displayed on the terminal. There will be a lot of other intermediate images for references which you can delete.The current version the default handles are of Awakened Indian. If you need to change them you need to pass additional arguments. Following is an example where I am using the code for sae.news.fromsaenews.utilsimportput_quoteput_quote('image.jpg',fb_logo='www.sae.news',tw_logo='saenews_')Note that it has also put a border. To remove the border use an argumentborder_width=0'fromsaenews.utilsimportquote,put_quoteput_quote('image.jpg',border_width=0)Repeating with aforloopSuppose the name of the images areimage1.jpg,image2.jpg,image3.jpg,image4.jpgwe can do all the four at one shot.fromsaenews.utilsimportquote,put_quoteimages=['image1.jpg','image2.jpg','image3.jpg','image4.jpg']foriinimages:put_quote(i,border_width=0)(There will be 4 images with the date and time of editing with it. The names will also be displayed on terminal.)Adding black strip at the bottomYou can add a black strip at the bottom so you can put an additional quote there.There is an another argument to control the width of the blackstrip.black_strip_dims=(left, top, right, bottom)Where in the place of left, top etc. we need to pass the ratio by which the black strip should be extended out of image. (Examples will make it very clear).Suppose the image height isHand width isW. You can add a black strip at the bottom of with 50% of the height of the current image you will use0.5in the fourth place.i.eblack_strip_dims=(0,0,0,0.5)This will add an addition black strip at the bottom of height0.5*H.Example :fromsaenews.utilsimportquote,put_quoteput_quote('image.jpg',black_strip_dims=(0,0,0,0.5))Adding quotes or title/ taglineYou can add title and a tagline for the image. The nomenclature is title and tagline as the library was first build for News images. You can use the title for Quotes and tagline to mention the person who said it. Or any other purposes.The title and tagline takes few arguments.argDescriptionDatatypeDefault ValueExampletitleTitle textstring'''Be the change you want to see'title_cordNormalised cordinates of the beginning of the titletupple (float,float)(0.035,0.666)(0.035,0.666)title_font_sizeSize of the font(Not normalised)int/float''55title_width_ratioWidth of the title (Normalised)Float''0.9title_text_fontFont used in the textstring containing path to Font File(Required only when you want to change to new font)'./Arial.otf'Example :fromsaenews.utilsimportquote,put_quotetitle="Be the change you want to see!"put_quote(input_file='image.jpg',title=title,title_cord=(0.035,0.666),title_font_size=80,title_width_ratio=0.9)Adding Tagline.Tagline has exactly the same features but the font is different. You can infact put the title twice. Tagline is used just for convinience.argDescriptionDatatypeDefault ValueExampletag_lineTagline textstring'''-Mahatma Gandhi'tag_cordNormalised cordinates of the beginning of the titletupple (float,float)Auto set based on the height and width of Title(0.035,0.666)tag_font_sizeSize of the font(Not normalised)int/float''55tag_width_ratioWidth of the tagline (Normalised)Float''0.9tag_text_fontFont used in the textstring containing path to Font File(Required only when you want to change to new font)'./Arial.otf'Example :fromsaenews.utilsimportquote,put_quotetitle="Be the change you want to see!"tag_line="-- Mahatma Gandhi"put_quote(input_file='image.jpg',title=title,tag_line=tag_line,title_cord=(0.035,0.666),title_font_size=80,title_width_ratio=0.9)# Other featuresChange Border Color, No Logo, Focussing etc.argDescriptionDatatypeDefault ValueExampleborder_colorChange the color of borderstringredorangelogoAdd logo or notBooleanTruelogo=FalsefocusWhere to Focus?(Vignette)string''(Searches for face. If it does not get then focusses on center)Other values : 'center'(focus on center),'false' (False will not focus)ContributeTo contribute : please clone the repo. Make a branch and send a pull request.If you find any bugs ask in the Issues sectionsIf you think any new feature is to be added ask that too in the issues sectionUpdatesBugfixesOlder verion of READMEIssues and feature requestsIf you find any bug or if you find any feature missing. Raise an issueDo Visit our websiteSAE NEWS