archive-com.com » COM » N » NITOYON.COM

Total: 757

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Space travel animated GIF generated by Golang - TECH-NI Blog
    with image Paletted in order to create animated gif Convert image RBGA to image Paletted gif Encode automatically convert image RBGA to image Paletted using draw FloydSteinberg but gif EncodeAll doesn t So we have to convert for our own Let s convert using draw FloydSteinberg like gif Encode method package main import image image color image draw func main img image NewRGBA image Rect 0 0 200 200 Initialize palette ffffff 000000 ff0000 var palette color Palette color Palette palette append palette color White palette append palette color Black palette append palette color RGBA 0xff 0x00 0x00 0xff Dithering pm image NewPaletted img Bounds palette draw FloydSteinberg Draw pm img Bounds img image ZP Full source code Here is the full source code 100 lines package main import github com llgcode draw2d draw2dimg github com llgcode draw2d draw2dkit image image color image draw image gif math math rand os var w h float64 500 250 var palette color Palette color Palette var zCycle float64 8 var zMin zMax float64 1 15 type Point struct X Y float64 type Circle struct X Y Z R float64 Draw stars in order to generate perfect loop GIF func c Circle Draw gc draw2dimg GraphicContext ratio float64 z c Z ratio zCycle for z zMax if z zMin x y r c X z c Y z c R z gc SetFillColor color White gc Fill draw2dkit Circle gc w 2 x h 2 y r gc Close z zCycle func drawFrame circles Circle ratio float64 image Paletted img image NewRGBA image Rect 0 0 int w int h gc draw2dimg NewGraphicContext img Draw background gc SetFillColor color Gray 0x11 draw2dkit Rectangle gc 0 0 w h gc Fill gc Close Draw stars for circle range circles circle Draw gc ratio Dithering pm

    Original URL path: http://tech.nitoyon.com/en/blog/2016/01/18/space-travel-animated-gif/ (2016-02-13)
    Open archived version from archive


  • Tag: Go - TECH-NI Blog
    generated by Golang 18 Jan 2016 Go Generate an animated GIF with Golang 07 Jan 2016 Go Generate an image programmatically with Golang 31 Dec 2015 Go Back to tag list About Profile nitoyon I m a programmer in Japan

    Original URL path: http://tech.nitoyon.com/en/blog/tags/go/ (2016-02-13)
    Open archived version from archive

  • Generate an animated GIF with Golang - TECH-NI Blog
    with gif Decode If we read JPEG images we have to convert them programatically goanigiffy does this by calling gif Encode and gif Decode Call gif EncodeAll to save animated GIF Convert video to Animated GIF Use MPlayer to extract frames and create animated GIF with goanigiffy see GoAniGiffy for details Programatically Let s generate animated GIF programatically Generate image Paletted programatically and pass it to gif EncodeAll var images image Paletted var delays int create 20 images and draw circles for step 0 step 20 step img image NewPaletted image Rect 0 0 w h palette images append images img delays append delays 0 drawing code too long save to rgb gif f os OpenFile rgb gif os O WRONLY os O CREATE 0600 defer f Close gif EncodeAll f gif GIF Image images Delay delays The entire code is as follows package main import image image color image gif math os type Circle struct X Y R float64 func c Circle Brightness x y float64 uint8 var dx dy float64 c X x c Y y d math Sqrt dx dx dy dy c R if d 1 return 0 else return 255 func main var w h int 240 240 var hw hh float64 float64 w 2 float64 h 2 circles Circle Circle Circle Circle var palette color Color color RGBA 0x00 0x00 0x00 0xff color RGBA 0x00 0x00 0xff 0xff color RGBA 0x00 0xff 0x00 0xff color RGBA 0x00 0xff 0xff 0xff color RGBA 0xff 0x00 0x00 0xff color RGBA 0xff 0x00 0xff 0xff color RGBA 0xff 0xff 0x00 0xff color RGBA 0xff 0xff 0xff 0xff var images image Paletted var delays int steps 20 for step 0 step steps step img image NewPaletted image Rect 0 0 w h palette images append images img delays

    Original URL path: http://tech.nitoyon.com/en/blog/2016/01/07/go-animated-gif-gen/ (2016-02-13)
    Open archived version from archive

  • Generate an image programmatically with Golang - TECH-NI Blog
    image img image NewRGBA image Rect 0 0 100 50 Draw a red dot at 2 3 img Set 2 3 color RGBA 255 0 0 255 Save to out png f os OpenFile out png os O WRONLY os O CREATE 0600 defer f Close png Encode f img More Complecated Example Then let s make more complected image The code is as follows package main import fmt image image color image png math os type Circle struct X Y R float64 func c Circle Brightness x y float64 uint8 var dx dy float64 c X x c Y y d math Sqrt dx dx dy dy c R if d 1 return 0 else return 255 func main var w h int 280 240 var hw hh float64 float64 w 2 float64 h 2 r 40 0 θ 2 math Pi 3 cr Circle hw r math Sin 0 hh r math Cos 0 60 cg Circle hw r math Sin θ hh r math Cos θ 60 cb Circle hw r math Sin θ hh r math Cos θ 60 m image NewRGBA image Rect 0 0 w h for x 0 x w x for y 0 y h y c color RGBA cr Brightness float64 x float64 y cg Brightness float64 x float64 y cb Brightness float64 x float64 y 255 m Set x y c f err os OpenFile rgb png os O WRONLY os O CREATE 0600 if err nil fmt Println err return defer f Close png Encode f m We define Circle struct and determine color by calling its Brightness method c color RGBA cr Brightness float64 x float64 y cg Brightness float64 x float64 y cb Brightness float64 x float64 y 255 Brightness returns 255 when x y is in

    Original URL path: http://tech.nitoyon.com/en/blog/2015/12/31/go-image-gen/ (2016-02-13)
    Open archived version from archive

  • Jenkins: How to change JENKINS_HOME on Windows - TECH-NI Blog
    This means that Jenkins stores all data including plugins workspace and job data to C Program Files x86 jenkins On windows it is recommended that application data is stored to ProgramData and AppData So I wanted to change JENKINS HOME First I added JENKINS HOME to environment value but it doen t make any sense Jenkins prefers the value set on jenkins xml when we use MSI installer Now let s change JENKINS HOME to C ProgramData Jenkins Jenkins version 1 550 Stop Jenkins service Open jenkins xml in the install folder and edit env name JENKINS HOME value BASE as follows env name JENKINS HOME value ProgramData Jenkins Move all files in install folder except for the following files Don t copy because it brokes symbolic links in jobs folder jre folder jenkins err log jenkins exe jenkins exe config jenkins out log jenkins war jenkins war bak jenkins war tmp jenkins wrapper log jenkins xml Start Jenkins service Open http localhost 8080 systemInfo and check JEKNINS HOME has been changed Enjoy Tweet 25 Feb 2014 View history Windows Related Entries Chef Console avoid multiple ruby problem on Windows Difference between fs watch and fs watchFile Use symlinks in

    Original URL path: http://tech.nitoyon.com/en/blog/2014/02/25/jenkins-home-win/ (2016-02-13)
    Open archived version from archive

  • Tag: Windows - TECH-NI Blog
    Windows 25 Feb 2014 Windows Chef Console avoid multiple ruby problem on Windows 29 Jan 2014 Windows Use symlinks in git difftool dir diff on Windows 09 Jul 2013 Windows Back to tag list About Profile nitoyon I m a

    Original URL path: http://tech.nitoyon.com/en/blog/tags/windows/ (2016-02-13)
    Open archived version from archive

  • Chef Console: avoid multiple ruby problem on Windows - TECH-NI Blog
    are added to PATH C opscode chef bin Chef related programs such as chef solo knife C opscode chef embedded bin UNIX related programs such as ruby exe perl exe ls exe cat exe Conflicts with existing Ruby environment I have ruby exe in C Ruby200 x64 bin which is added to PATH Which ruby is used when I run ruby or gem install xxxx from my MS DOS prompt If we first install Ruby and then install Chef C Ruby200 x64 bin gem is executed If we first install Chef and then install Ruby C opscode chef embedded bin gem is executed It s very confusing Let s use Chef console To solve this problem I created a Chef console 1 Create a bat file Save following file as C opscode chefenv bat ECHO OFF SET PATH c opscode chef bin c opscode chef embedded bin SET PATH PATH c windows system 32 c windows title Chef Env chef solo v 2 Create a shortcut file Create a shortcut file to this bat Target C Windows System32 cmd exe K C opscode chefenv bat Start in Anywhere My document path to chef repository and so on K means Carries

    Original URL path: http://tech.nitoyon.com/en/blog/2014/01/29/chef-win-path/ (2016-02-13)
    Open archived version from archive

  • Visualizing K-Means algorithm with D3.js - TECH-NI Blog
    figure or push Step button to go to next step Push Restart button to go back to initialization step Push New button to start new simulation with given N the number of nodes and K the number of clusters Requires modern browsers tested on IE 10 Firefox 25 and Chrome 30 What is K Means You can find a detail description at k means clustering Wikipedia the free encyclopedia but it s too complecated to understand Here is simpler steps Initialization Create N nodes circle and randomly put initial K cluster cross Assignment step Assign each node circle to the nearest cluster cross Update step Each cluster cross move to the centroid of its nodes Go to step 2 D3 js and ActionScript 3 This visualization is JavaScript port of my past work Visualization of K means algorithm with ActionScript 3 Japanese only with D3 js I like D3 js s powerful data binding and animation APIs It makes my code simple But Flash shows smoother animations Tweet 07 Nov 2013 View history JavaScript Related Entries When grunt contrib watch uses too much CPU try grunt este watch LiveReloadX Released Reload your Browser Automatically Color Illusion Generator released 50 polygons

    Original URL path: http://tech.nitoyon.com/en/blog/2013/11/07/k-means/ (2016-02-13)
    Open archived version from archive



  •