// localImageMagick returns the path to the local ImageMagick "magick" binary,
// if it's new enough. Otherwise it returns the empty string.
168248
func localImageMagick() string {
	bin, err := exec.LookPath("magick")
	if err != nil {
		return ""
	}
	magickHasHEIC.Lock()
	defer magickHasHEIC.Unlock()
	if magickHasHEIC.checked {
		if magickHasHEIC.heic {
			return bin
		}
		return ""
	}
	magickHasHEIC.checked = true
	out, err := exec.Command(bin, "-version").CombinedOutput()
	if err != nil {
		log.Printf("internal/images: error checking local machine's imagemagick version: %v, %s", err, out)
		return ""
	}
	if strings.Contains(string(out), " heic") {
		magickHasHEIC.heic = true
		return bin
	}
	return ""
}
458808
func (i *LocalInstaller) Path() string {
	if i.Source == "" {
		return ""
	}
	return filepath.Join(i.Home.Rigs(), i.Name)
}
1287495
func ImgToBytes(path string) []byte {
	img, fm, err := DecodeFile(path)
	if err != nil {
		log.Println("to image...", err)
		return nil
	}

	return ToBytes(img, fm)
}
1077657
func (s *IndicesGetSettingsService) Local(local bool) *IndicesGetSettingsService {
	s.local = &local
	return s
}
428787
func NormalizeImageName(image string) string {
	if !strings.Contains(image, ":") {
		return fmt.Sprintf("%s:latest", image)
	}
	return image
}
259610
func (this *Weixinmp) SendImageMsg(touser string, mediaId string) error {
	var msg imageMsg
	msg.MsgType = "image"
	msg.Image.MediaId = mediaId
	return this.sendMsg(touser, &msg)
}
209007
func (client *RegistryIndexClient) FindImage(image string) (*registry.Image, error) {
	image, err := client.parseImage(image)
	if err != nil {
		return nil, err
	}
	rImage, err := client.facade.GetRegistryImage(client.ctx, image)
	if datastore.IsErrNoSuchEntity(err) {
		return nil, ErrImageNotFound
	}
	return rImage, err
}
1066512
func LocalAssets(path string) ([]string, error) {
	path, err := filepath.Abs(path)
	if err != nil {
		return nil, errors.Wrap(err, "failed to get abs path")
	}

	fi, err := os.Stat(path)
	if err != nil {
		return nil, errors.Wrap(err, "failed to get file stat")
	}

	if !fi.IsDir() {
		return []string{path}, nil
	}

	// Glob all files in the given path
	files, err := filepath.Glob(filepath.Join(path, "*"))
	if err != nil {
		return nil, errors.Wrap(err, "failed to glob files")
	}

	if len(files) == 0 {
		return nil, errors.New("no local assets are found")
	}

	assets := make([]string, 0, len(files))
	for _, f := range files {

		// Exclude directory.
		if fi, _ := os.Stat(f); fi.IsDir() {
			continue
		}

		assets = append(assets, f)
	}

	return assets, nil
}
611658
func ImgBuildDir(path string) option {
	return func(c *sass) error {
		c.ctx.GenImgDir = path
		return nil
	}
}
474188
func GetLocalPath(repo string, chartpath string) (string, error) {
	var depPath string
	var err error
	p := strings.TrimPrefix(repo, "file://")

	// root path is absolute
	if strings.HasPrefix(p, "/") {
		if depPath, err = filepath.Abs(p); err != nil {
			return "", err
		}
	} else {
		depPath = filepath.Join(chartpath, p)
	}

	if _, err = os.Stat(depPath); os.IsNotExist(err) {
		return "", fmt.Errorf("directory %s not found", depPath)
	} else if err != nil {
		return "", err
	}

	return depPath, nil
}
1322214
func (u URL) LocalPath() string {
	switch {
	case u.Type == URLTypeLocal:
		return u.URL.Path
	case u.Type == URLTypeURL && u.URL.Scheme == "file" && u.URL.Opaque == "":
		if runtime.GOOS == "windows" && len(u.URL.Path) > 0 && u.URL.Path[0] == '/' {
			return filepath.FromSlash(u.URL.Path[1:])
		}
		return filepath.FromSlash(u.URL.Path)
	}
	panic("LocalPath called on non-local URL")
}
606329
func getImageVisibility(visibility string) (*images.ImageVisibility, error) {
	visibilities := [...]images.ImageVisibility{
		images.ImageVisibilityPublic,
		images.ImageVisibilityPrivate,
		images.ImageVisibilityCommunity,
		images.ImageVisibilityShared,
	}

	for _, v := range visibilities {
		if string(v) == visibility {
			return &v, nil
		}
	}

	return nil, fmt.Errorf("Not a valid visibility: %s", visibility)
}
612325
func (g *Generator) SetVMImagePath(path string) error {
	if !strings.HasPrefix(path, "/") {
		return fmt.Errorf("imagePath %v is not an absolute path", path)
	}
	g.initConfigVMImage()
	g.Config.VM.Image.Path = path
	return nil
}
1342874
func GetFSMagic(rootpath string) (FsMagic, error) {
	var buf unix.Statfs_t
	if err := unix.Statfs(rootpath, &buf); err != nil {
		return 0, err
	}
	return FsMagic(buf.Type), nil
}
803008
func LocalConfigDirectoryAbsolutePath() (string, error) {
	root, err := gitutil.RepositoryRootAbsolutePath()
	if err != nil {
		return "", err
	}
	return filepath.Join(root, LocalConfigDirname), nil
}
457805
func GetGenericImage(prefix, image, tag string) string {
	return fmt.Sprintf("%s/%s:%s", prefix, image, tag)
}
640992
func (_m *APIClient) ImageInspectWithRaw(ctx context.Context, _a1 string) (types.ImageInspect, []byte, error) {
	ret := _m.Called(ctx, _a1)

	var r0 types.ImageInspect
	if rf, ok := ret.Get(0).(func(context.Context, string) types.ImageInspect); ok {
		r0 = rf(ctx, _a1)
	} else {
		r0 = ret.Get(0).(types.ImageInspect)
	}

	var r1 []byte
	if rf, ok := ret.Get(1).(func(context.Context, string) []byte); ok {
		r1 = rf(ctx, _a1)
	} else {
		if ret.Get(1) != nil {
			r1 = ret.Get(1).([]byte)
		}
	}

	var r2 error
	if rf, ok := ret.Get(2).(func(context.Context, string) error); ok {
		r2 = rf(ctx, _a1)
	} else {
		r2 = ret.Error(2)
	}

	return r0, r1, r2
}